home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-27 | 110.8 KB | 4,574 lines |
- ;OCL{{{}}}
- ;OCL{{{ user macros
- ( defusermacros 10 )
- ;OCL{{{ user-macro-x
- ( defmac user-macro-0 ( execute-number-macro 1 ) )
- ( defmac user-macro-1 ( execute-number-macro 2 ) )
- ( defmac user-macro-2 ( execute-number-macro 3 ) )
- ( defmac user-macro-3 ( execute-number-macro 4 ) )
- ( defmac user-macro-4 ( execute-number-macro 5 ) )
- ( defmac user-macro-5 ( execute-number-macro 6 ) )
- ( defmac user-macro-6 ( execute-number-macro 7 ) )
- ( defmac user-macro-7 ( execute-number-macro 8 ) )
- ( defmac user-macro-8 ( execute-number-macro 9 ) )
- ( defmac user-macro-9 ( execute-number-macro 10 ) )
- ;OCL}}}
- ;OCL{{{ def-user-macro
- ( defvar ( u-m-no ) )
- ( deffun def-user-macro
- ( if not(in-prompt)
- ( para
- prompt-counter u-m-no ( "user-macro " "? " )
- if not(and(>(-(u-m-no 9) 0) <=(u-m-no 0)))
- ( set u-m-no +(u-m-no 1)
- save-keyboard-macro counter u-m-no newline-and-indent
- )
- fi
- edit
- )
- fi
- )
- )
- ( undeclare ( u-m-no ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ vars
- ( defvar
- ( buffer-moving ; buffer-move-mode is activ
- moving ; move-mode is activ
- stepping ; line-movement display or file-based?
- status-line ; display status-line in edit-mode?
- buff-saving ; is buffer-save-mode activ?
- irline ; cursor level for indent region
- command ; left move-mode after succesful command?
- startup ; 1, if startup-code was executed
- highlight-off ; no highlighted display during creat-fold/move-mode
- full-shifting ; is full-shift-mode active?
- prompting ; have libraries to call prompt-macros?
- cmd-in ; variable for reading command in menus ..
- extended-version ; use the extended-,not-extended- or raw-mode?
- no-auto-change ; do not change the file in read-newfile-macro
- @if-using ( SHELL-MODE )
- shell-mode-active
- ; switch to ModeOriShell at quit of editing
- @fi
- @if-using ( SUNEDT )
- EDT-used ; TERM on SUNEDT or ORIGAMITERM on SUNEDT
- EDT-move-back ; edt simulation moves back
- @fi
- )
- )
- ( history make-cmd-hist )
- ( history mail-cmd-hist )
- ( history string-buffer )
- @if-using ( SHELL-MODE )
- ( history I-edit-cmd )
- ( history I-nn-cmd )
- @fi
- ;OCL}}}
- ;OCL{{{ forward declarations
- ( forward switch-off-buffer-handling )
- ( forward switch-on-buffer-handling )
- ( forward b-m-menu )
- ( forward change-buffer-macro-exe )
- ( forward read-newfile-macro-exe )
- ( forward switch-to-move-mode )
- ( forward switch-to-edit-mode )
- ( forward switch-status-line-on )
- ( forward switch-status-line-off )
- ( forward abort-hook )
- ( forward knb-macro )
- ( forward v-macro )
- ( forward begin-prompt )
- ( forward end-prompt )
- ( forward set-mode-raw )
- ( forward add-mode-extended )
- ( forward delete-mode-extended )
- @if-using ( SHELL-MODE )
- @if-using (MOUSY)
- ( forward ( cmd ) shell-mouse )
- @fi
- ( forward add-mode-shell )
- ( forward I-startup-read )
- ( forward I-startup )
- ( forward I-key-not-bound )
- ( forward begin-shell-mode )
- ( forward end-shell-mode )
- ( forward I-view-macro )
- ( forward I-abort-hook )
- ( forward I-prompt-in )
- ( forward I-prompt-out )
- @fi
- ;OCL}}}
- ;OCL{{{ declare macro-hooks
- ( abort-macro abort-hook )
- ( change-buffer-macro change-buffer-macro-exe)
- ( read-newfile-macro read-newfile-macro-exe )
- ( key-not-bound-macro knb-macro )
- ( view-macro v-macro )
- ( begin-prompt-macro begin-prompt )
- ( end-prompt-macro end-prompt )
- ;OCL}}}
- ;OCL{{{ character-set handling
- @use ( language-ocl )
- @lib userlang
- ;OCL{{{ variables
- ( defvar ( char-set-changed ) )
- ;OCL}}}
- ;OCL{{{ touch-char-sets
- ( defmac touch-char-sets ( set char-set-changed true ) )
- ;OCL}}}
- ;OCL{{{ setup-char-sets
- ( deffun setup-char-sets
- ( if char-set-changed
- ( case
- ;OCL{{{ programming
- ( or
- ( test-language C
- test-language Pascal
- test-language Occam
- test-language Inmos
- test-language Script
- )
- ( defset word-char word-char-coding )
- )
- ;OCL}}}
- ;OCL{{{ ocl
- ( eval ( test-language-ocl )
- ( defset word-char word-char-ocl )
- )
- ;OCL}}}
- default
- ;OCL{{{ text
- ( defset word-char word-char-text )
- ;OCL}}}
- esac
- set char-set-changed false
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ redefine set-language and search-commands
- ;OCL{{{ set-language
- ( defmac set-language- ( set-language ) )
- ( undeclare ( set-language ) )
- ( deffun set-language ( touch-char-sets set-language- ) )
- ( undeclare ( set-language- ) )
- ;OCL}}}
- ;OCL{{{ search-forward
- ( defmac search-forward- ( search-forward ) )
- ( undeclare ( search-forward ) )
- ( deffun search-forward ( setup-char-sets search-forward- ) )
- ( undeclare ( search-forward- ) )
- ;OCL}}}
- ;OCL{{{ incremental-search-forward
- ( defmac incremental-search-forward- ( incremental-search-forward ) )
- ( undeclare ( incremental-search-forward ) )
- ( deffun incremental-search-forward ( setup-char-sets incremental-search-forward- ) )
- ( undeclare ( incremental-search-forward- ) )
- ;OCL}}}
- ;OCL{{{ query-replace-string
- ( defmac query-replace-string- ( query-replace-string ) )
- ( undeclare ( query-replace-string ) )
- ( deffun query-replace-string ( setup-char-sets query-replace-string- ) )
- ( undeclare ( query-replace-string- ) )
- ;OCL}}}
- ;OCL{{{ replace-string
- ( defmac replace-string- ( replace-string ) )
- ( undeclare ( replace-string ) )
- ( deffun replace-string ( setup-char-sets replace-string- ) )
- ( undeclare ( replace-string- ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ undeclares
- ( undeclare ( char-set-changed ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ auto-save
- ( forward mori-dump-buffers-to-file )
- ;OCL{{{ variables
- ( defvar ( a-s-delayed a-s-delaying a-s-x a-s-done ) )
- ;OCL}}}
- ;OCL{{{ auto-save-hook
- @lib hide-buffer
- ( forward e-m-save-file )
- ( deffun auto-save-hook
- ( @if-using ( SHELL-MODE )
- if shell-mode-active
- ( return-from-macro )
- fi
- @fi
- set a-s-delayed a-s-delaying
- if not(a-s-delayed)
- ( set a-s-x current-buffer-number
- ;OCL{{{ save all buffers
- screen-off
- push-buffer-layout
- ;OCL{{{ loop
- local
- ( a-s-x )
- (
- set a-s-done 0
- set a-s-x 1
- while <=(a-s-x used-buffers)
- ;OCL{{{ save buffer
- ( goto-buffer-number a-s-x
- if test-file-changed
- ( e-m-save-file
- if not(test-file-changed)
- ( set a-s-done +(a-s-done 1))
- fi
- )
- fi
- set a-s-x +(a-s-x 1)
- )
- ;OCL}}}
- )
- ;OCL}}}
- goto-buffer-number a-s-x
- pop-buffer-layout
- screen-on
- redraw-display
- ;OCL}}}
- ;OCL{{{ maybe save buffers
- if buff-saving ( mori-dump-buffers-to-file ) fi
- ;OCL}}}
- if a-s-done ( message ( "[ counter a-s-done " "auto-saved "] ) ) fi
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ delay-auto-save
- ( defmac delay-auto-save ( set a-s-delaying +(a-s-delaying 1) ) )
- ;OCL}}}
- ;OCL{{{ flush-auto-save
- ( defmac flush-auto-save
- ( if >(a-s-delaying 0)
- ( set a-s-delaying -(a-s-delaying 1)
- if a-s-delayed ( auto-save-hook ) fi
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ restore-auto-save
- ( defmac restore-auto-save
- ( set a-s-delaying 0
- if a-s-delayed ( auto-save-hook ) fi
- )
- )
- ;OCL}}}
- ( autosave-macro auto-save-hook )
- ;OCL{{{ undelcares
- ( undeclare ( a-s-delayed a-s-delaying a-s-x a-s-done auto-save-hook ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ standard macro
- @lib delspaces
- @lib delchar
- @lib overwdel
- @lib error
- @lib mt-fold
- @lib go-line
- @lib append
- @lib pre-char
- ( demand-load ( @lib noover ) )
- ;OCL{{{ mori-goto-matching-brace
- ( demand-load ( @lib go-match ) )
- ( defmac mori-goto-matching-brace ( goto-matching-fence ) )
- ;OCL}}}
- ;OCL{{{ word-jumps
- ;OCL{{{ backward-word
- ;OCL{{{ backward-text-word
- ;OCL{{{ word-line-up
- ( deffun word-line-up
- ( if test-top ( failed ) fi
- previous-line
- end-of-line
- )
- )
- ;OCL}}}
-
- ( defmac backward-text-word
- (
- ;OCL{{{ one step left
- if test-begin-line
- ( word-line-up )
- else
- ( backward-character )
- fi
- ;OCL}}}
- while not(test-char-set word-char)
- ;OCL{{{ back or line up
- ( if =(+(store-pos -1) 0)
- ( word-line-up )
- else
- ( backward-character )
- fi
- )
- ;OCL}}}
- ;OCL{{{ start-word
- while test-char-set word-char
- ( if test-begin-line
- ( return-from-macro )
- else
- ( backward-character )
- fi
- )
- forward-character
- ;OCL}}}
- )
- )
- ;OCL}}}
-
- ( deffun backward-word
- ( case
- ( in-prompt ( ) )
- default
- ( setup-char-sets
- backward-text-word
- )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ forward-word
- ;OCL{{{ forward-text-word
- ;OCL{{{ word-line-down go to beginning of next line for word
- ( deffun word-line-down
- ( if test-bottom ( failed ) fi
- next-line
- beginning-of-line
- )
- )
- ;OCL}}}
-
- ( defmac forward-text-word
- (
- ;OCL{{{ end word or next-line
- if test-end-line
- ( word-line-down )
- else
- ( while test-char-set word-char ( forward-character ) )
- fi
- ;OCL}}}
- while not(test-char-set word-char)
- ;OCL{{{ right or down
- ( if test-end-line ( word-line-down ) else ( forward-character ) fi )
- ;OCL}}}
- )
- )
- ;OCL}}}
-
- ( deffun forward-word
- ( case
- ( in-prompt ( ) )
- default
- ( setup-char-sets
- forward-text-word
- )
- esac
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ mode-center
- ( defvar ( centering ) )
- ;OCL{{{ add-mode-center
- ( deffun add-mode-center
- ( set centering true
- set-cursor-line div(screen-height 2)
- )
- )
- ;OCL}}}
- ;OCL{{{ delete-mode-center
- ( deffun delete-mode-center ( set centering false ) )
- ;OCL}}}
- ;OCL{{{ do-mode-center
- ( deffun do-mode-center
- ( if centering
- ( set-cursor-line div(screen-height 2) )
- fi
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ mori-next-line
- ( deffun mori-next-line
- ( if and(not(in-prompt) test-fold-line stepping)
- ( open-fold )
- fi
- next-line
- do-mode-center
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-previous-line
- ( deffun mori-previous-line
- ( previous-line
- while and(not(in-prompt) test-fold-line stepping)
- ( open-fold mtool-bot )
- do-mode-center
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-open-fold
- ( defvar ( op-f-k ) )
- ( deffun mori-open-fold
- ( case
- ;OCL{{{ not directly after open -> open
- ( <>(key-count op-f-k) ( open-fold set op-f-k +(key-count 1) ) )
- ;OCL}}}
- ;OCL{{{ moving -> nop
- ( moving () )
- ;OCL}}}
- ;OCL{{{ filed -> open failed -> enter
- ( test-filed ( enter-fold ) )
- ;OCL}}}
- ;OCL{{{ begin-fold -> close and enter
- ( test-begin-fold ( close-fold enter-fold previous-line ) )
- ;OCL}}}
- esac
- )
- )
- ( undeclare ( op-f-k ) )
- ;OCL}}}
- ;OCL{{{ mori-close-fold
- ( defvar ( cl-f-k ) )
- ( deffun mori-close-fold
- ( case
- ;OCL{{{ direct after failed close -> exit
- ( <>(key-count cl-f-k)
- ( if last-message M_USE_EXIT () fi
- if last-message M_TOP () fi
- close-fold
- if or(last-message M_TOP last-message M_USE_EXIT)
- ( set cl-f-k +(key-count 1)
- bell visible-bell
- show-cursor 5
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ moving -> nop
- ( moving () )
- ;OCL}}}
- default
- ;OCL{{{ exit and open, if possible
- ( exit-fold
- if not(test-filed) ( open-fold ) fi
- )
- ;OCL}}}
- esac
- )
- )
- ( undeclare ( cl-f-k ) )
- ;OCL}}}
- ;OCL{{{ page-moves
- ( defvar ( np-level np-height ) )
- ;OCL{{{ next-page
- ( defmac next-page-def ( next-page ) )
- ( undeclare ( next-page ) )
- ( deffun next-page
- ( if in-prompt
- ( next-page-def )
- else
- (
- ;OCL{{{ get number of skip-lines
- set-counter np-level cursor-level
- set-counter np-height -( screen-height 1 )
- ;OCL}}}
- ;OCL{{{ skip and set cursor
- screen-off
- while >(np-height 0)
- ;OCL{{{ skip one line
- ( next-line
- if and(stepping test-fold-line)
- ;OCL{{{ open and stop the loop
- ( open-fold
- set-counter np-height 0
- )
- ;OCL}}}
- else
- ;OCL{{{ decrement the number of skip-lines
- ( set-counter np-height -(np-height 1) )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- screen-on
- set-cursor-line np-level
- ;OCL}}}
- )
- fi
- )
- )
- ( undeclare ( next-page-def ) )
- ;OCL}}}
- ;OCL{{{ previous-page
- ( defmac previous-page-def ( previous-page ) )
- ( undeclare ( previous-page ) )
- ( deffun previous-page
- ( if in-prompt
- ( previous-page-def )
- else
- (
- ;OCL{{{ get number of skip-lines
- set-counter np-level cursor-level
- set-counter np-height -( screen-height 1 )
- ;OCL}}}
- ;OCL{{{ skip and set cursor
- screen-off
- while >(np-height 0)
- ;OCL{{{ skip one line
- ( previous-line
- if and(stepping test-fold-line)
- ;OCL{{{ open and stop the loop
- ( open-fold
- mtool-bot
- set-counter np-height 0
- )
- ;OCL}}}
- else
- ;OCL{{{ decrement the number of skip-lines
- ( set-counter np-height -(np-height 1) )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- screen-on
- set-cursor-line np-level
- ;OCL}}}
- )
- fi
- )
- )
- ( undeclare ( previous-page-def ) )
- ;OCL}}}
- ( undeclare ( np-level np-height ) )
- ;OCL}}}
- ;OCL{{{ add-mode-file-based
- ( deffun add-mode-file-based ( set-counter stepping true set-user-mode STEP ) )
- ;OCL}}}
- ;OCL{{{ delete-mode-file-based
- ( deffun delete-mode-file-based ( set-counter stepping false reset-user-mode STEP ) )
- ;OCL}}}
- ;OCL{{{ marks
- ;OCL{{{ define the needed vars
- ( defvar
- ( mark-line mark-file
- mark-line-0 mark-file-0
- mark-line-1 mark-file-1
- mark-line-2 mark-file-2
- mark-line-3 mark-file-3
- mark-line-4 mark-file-4
- mark-line-5 mark-file-5
- mark-line-6 mark-file-6
- mark-line-7 mark-file-7
- mark-line-8 mark-file-8
- mark-line-9 mark-file-9
- push-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ go-last-mark
- ( deffun go-last-mark
- (
- ;OCL{{{ maybe change the file
- if <>(-(file-number mark-file) 0)
- (
- ;OCL{{{ moving cannot change files
- if moving
- ( switch-to-edit-mode
- bell
- visible-bell
- message-exit ( "[ "no " "filechange " "in " "move-mode! "] )
- )
- fi
- ;OCL}}}
- ;OCL{{{ change the file
- if last-message M_FILEPO () fi
- if >(push-mark 0) ( enter-list-file ) else ( read-list-file ) fi
- if not(last-message M_FILEPO) ( insert-ascii I_YES newline-and-indent ) fi
- counter mark-file
- newline-and-indent
- ;OCL}}}
- )
- fi
- ;OCL}}}
- goto-line-counter mark-line
- )
- )
- ;OCL}}}
- ;OCL{{{ 0
- ;OCL{{{ set-mark-0
- ( deffun set-mark-0
- ( set-counter mark-file-0 file-number
- set-counter mark-line-0 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-0
- ( deffun go-mark-0
- ( set-counter mark-file mark-file-0
- set-counter mark-line mark-line-0
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-0
- ( deffun push-mark-0
- ( set-counter mark-file mark-file-0
- set-counter mark-line mark-line-0
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-0
- ( deffun swap-mark-0
- ( set-counter mark-file mark-file-0
- set-counter mark-line mark-line-0
- set-counter push-mark 1
- set-mark-0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 1
- ;OCL{{{ set-mark-1
- ( deffun set-mark-1
- ( set-counter mark-file-1 file-number
- set-counter mark-line-1 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-1
- ( deffun go-mark-1
- ( set-counter mark-file mark-file-1
- set-counter mark-line mark-line-1
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-1
- ( deffun push-mark-1
- ( set-counter mark-file mark-file-1
- set-counter mark-line mark-line-1
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-1
- ( deffun swap-mark-1
- ( set-counter mark-file mark-file-1
- set-counter mark-line mark-line-1
- set-counter push-mark 1
- set-mark-1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 2
- ;OCL{{{ set-mark-2
- ( deffun set-mark-2
- ( set-counter mark-file-2 file-number
- set-counter mark-line-2 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-2
- ( deffun go-mark-2
- ( set-counter mark-file mark-file-2
- set-counter mark-line mark-line-2
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-2
- ( deffun push-mark-2
- ( set-counter mark-file mark-file-2
- set-counter mark-line mark-line-2
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-2
- ( deffun swap-mark-2
- ( set-counter mark-file mark-file-2
- set-counter mark-line mark-line-2
- set-counter push-mark 1
- set-mark-2
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 3
- ;OCL{{{ set-mark-3
- ( deffun set-mark-3
- ( set-counter mark-file-3 file-number
- set-counter mark-line-3 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-3
- ( deffun go-mark-3
- ( set-counter mark-file mark-file-3
- set-counter mark-line mark-line-3
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-3
- ( deffun push-mark-3
- ( set-counter mark-file mark-file-3
- set-counter mark-line mark-line-3
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-3
- ( deffun swap-mark-3
- ( set-counter mark-file mark-file-3
- set-counter mark-line mark-line-3
- set-counter push-mark 1
- set-mark-3
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 4
- ;OCL{{{ set-mark-4
- ( deffun set-mark-4
- ( set-counter mark-file-4 file-number
- set-counter mark-line-4 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-4
- ( deffun go-mark-4
- ( set-counter mark-file mark-file-4
- set-counter mark-line mark-line-4
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-4
- ( deffun push-mark-4
- ( set-counter mark-file mark-file-4
- set-counter mark-line mark-line-4
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-4
- ( deffun swap-mark-4
- ( set-counter mark-file mark-file-4
- set-counter mark-line mark-line-4
- set-counter push-mark 1
- set-mark-4
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 5
- ;OCL{{{ set-mark-5
- ( deffun set-mark-5
- ( set-counter mark-file-5 file-number
- set-counter mark-line-5 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-5
- ( deffun go-mark-5
- ( set-counter mark-file mark-file-5
- set-counter mark-line mark-line-5
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-5
- ( deffun push-mark-5
- ( set-counter mark-file mark-file-5
- set-counter mark-line mark-line-5
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-5
- ( deffun swap-mark-5
- ( set-counter mark-file mark-file-5
- set-counter mark-line mark-line-5
- set-counter push-mark 1
- set-mark-5
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 6
- ;OCL{{{ set-mark-6
- ( deffun set-mark-6
- ( set-counter mark-file-6 file-number
- set-counter mark-line-6 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-6
- ( deffun go-mark-6
- ( set-counter mark-file mark-file-6
- set-counter mark-line mark-line-6
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-6
- ( deffun push-mark-6
- ( set-counter mark-file mark-file-6
- set-counter mark-line mark-line-6
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-6
- ( deffun swap-mark-6
- ( set-counter mark-file mark-file-6
- set-counter mark-line mark-line-6
- set-counter push-mark 1
- set-mark-6
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 7
- ;OCL{{{ set-mark-7
- ( deffun set-mark-7
- ( set-counter mark-file-7 file-number
- set-counter mark-line-7 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-7
- ( deffun go-mark-7
- ( set-counter mark-file mark-file-7
- set-counter mark-line mark-line-7
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-7
- ( deffun push-mark-7
- ( set-counter mark-file mark-file-7
- set-counter mark-line mark-line-7
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-7
- ( deffun swap-mark-7
- ( set-counter mark-file mark-file-7
- set-counter mark-line mark-line-7
- set-counter push-mark 1
- set-mark-7
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 8
- ;OCL{{{ set-mark-8
- ( deffun set-mark-8
- ( set-counter mark-file-8 file-number
- set-counter mark-line-8 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-8
- ( deffun go-mark-8
- ( set-counter mark-file mark-file-8
- set-counter mark-line mark-line-8
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-8
- ( deffun push-mark-8
- ( set-counter mark-file mark-file-8
- set-counter mark-line mark-line-8
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-8
- ( deffun swap-mark-8
- ( set-counter mark-file mark-file-8
- set-counter mark-line mark-line-8
- set-counter push-mark 1
- set-mark-8
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ 9
- ;OCL{{{ set-mark-9
- ( deffun set-mark-9
- ( set-counter mark-file-9 file-number
- set-counter mark-line-9 store-line
- )
- )
- ;OCL}}}
- ;OCL{{{ go-mark-9
- ( deffun go-mark-9
- ( set-counter mark-file mark-file-9
- set-counter mark-line mark-line-9
- set-counter push-mark 0
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ push-mark-9
- ( deffun push-mark-9
- ( set-counter mark-file mark-file-9
- set-counter mark-line mark-line-9
- set-counter push-mark 1
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL{{{ swap-mark-9
- ( deffun swap-mark-9
- ( set-counter mark-file mark-file-9
- set-counter mark-line mark-line-9
- set-counter push-mark 1
- set-mark-9
- go-last-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ undefine the needed vars
- ( undeclare
- ( mark-line mark-file
- mark-line-0 mark-file-0
- mark-line-1 mark-file-1
- mark-line-2 mark-file-2
- mark-line-3 mark-file-3
- mark-line-4 mark-file-4
- mark-line-5 mark-file-5
- mark-line-6 mark-file-6
- mark-line-7 mark-file-7
- mark-line-8 mark-file-8
- mark-line-9 mark-file-9
- push-mark
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ searches
- ;OCL{{{ mori-incremental-search-forward
- ( deffun mori-incremental-search-forward
- ( set-mark-0
- incremental-search-forward
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-search-forward
- ( deffun mori-search-forward
- ( set-mark-0
- search-forward
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-query-replace-string
- ( deffun mori-query-replace-string
- ( set-mark-0
- query-replace-string
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ mouse macros
- @if-using (MOUSY)
- @lib go-mouse
- ;OCL{{{ goto-window
- ( deffun goto-window
- ( if <>(mouse-buffer-number current-buffer-number)
- ( goto-buffer-number mouse-buffer-number )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ call-mouse-menu
- ( forward main-menu )
- ( forward move-menu )
- ( deffun call-mouse-menu
- ( case
- ( buffer-moving ( b-m-menu ) )
- ( moving ( move-menu ) )
- default
- ( main-menu )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ handle-mouse
- ( defvar ( g-a-c-m-l ) )
- ( forward ( x ) indent-region-sub )
- ( deffun ( cmd ) handle-mouse
- ( case
- ;OCL{{{ shell-mode
- @if-using ( SHELL-MODE )
- ( shell-mode-active ( shell-mouse(cmd) ) )
- @fi
- ;OCL}}}
- ;OCL{{{ indent-region -> shift to or abort
- ( irline
- ( if <(mouse-outside 0)
- ( switch-to-edit-mode )
- else
- ( indent-region-sub( -(mouse-x store-pos) ) )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ prompt -> nop
- ( or(in-prompt prompting) ( ) )
- ;OCL}}}
- ;OCL{{{ buffer -> switch or menu
- ( <>(buffer-moving 0)
- ( if <(mouse-outside 0)
- ( b-m-menu )
- else
- ( if <>(current-buffer-number mouse-buffer-number)
- ( switch-off-buffer-handling
- goto-buffer-number mouse-buffer-number
- switch-on-buffer-handling
- )
- fi
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ other window -> switch buffer
- ( and
- ( >=(mouse-outside 0)
- <>(mouse-buffer-number current-buffer-number)
- )
- ( if moving
- ( bell
- visible-bell
- message ( M_ERR_PO )
- )
- else
- ( go-mouse-position )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ on text-> go and act depending on button
- ( or(=(mouse-outside 0) =(mouse-outside 1))
- ( screen-off
- go-mouse-position
- case
- ;OCL{{{ cmd > 0 -> enter or open
- ( >(cmd 0)
- ( case
- ;OCL{{{ fold -> open
- ( test-fold-line
- ( open-fold
- screen-on
- redraw-display
- )
- )
- ;OCL}}}
- ;OCL{{{ filed -> maybe enter
- ( test-filed
- ( screen-on
- redraw-display
- if
- not
- ( or
- ( moving
- and
- ( ocl-argument
- pre ( set cmd -(cmd 1) ) =(cmd 0)
- )
- )
- )
- ( enter-fold )
- fi
- )
- )
- ;OCL}}}
- default
- ( screen-on
- redraw-display
- )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ cmd = 0 -> center
- ( =(cmd 0)
- ( screen-on
- center-and-redraw-display
- describe-fold
- )
- )
- ;OCL}}}
- default
- ;OCL{{{ cmd < 0 -> close
- ( set-counter g-a-c-m-l cursor-level
- if last-message M_USE_EXIT ( ) fi
- if last-message M_TOP ( ) fi
- close-fold
- set cmd +(cmd 1)
- case
- ( and(ocl-argument =(cmd 0)) ( ) )
- default
- ( if or
- ( last-message M_TOP
- last-message M_USE_EXIT
- <>(cmd 0) ; -> cmd was set to value < -1
- )
- ( screen-on
- redraw-display
- exit-fold
- return-from-macro
- )
- fi
- )
- esac
- screen-on
- set-cursor-line g-a-c-m-l
- )
- ;OCL}}}
- esac
- )
- )
- ;OCL}}}
- default
- ( call-mouse-menu )
- esac
- )
- )
- ( undeclare ( g-a-c-m-l ) )
- ;OCL}}}
- ;OCL{{{ go-and-open-mouse
- ( deffun go-and-open-mouse ( handle-mouse(1) ) )
- ;OCL}}}
- ;OCL{{{ go-and-close-mouse
- ( deffun go-and-close-mouse ( handle-mouse(-1) ) )
- ;OCL}}}
- ;OCL{{{ go-mouse-and-center
- ( deffun go-mouse-and-center ( handle-mouse(0) ) )
- ;OCL}}}
- @if-using ( FORCE-MOUSE-CMDS )
- ;OCL{{{ go-and-do-open-mouse
- ( deffun go-and-do-open-mouse ( handle-mouse(2) ) )
- ;OCL}}}
- ;OCL{{{ go-and-do-close-mouse
- ( deffun go-and-do-close-mouse ( handle-mouse(-2) ) )
- ;OCL}}}
- @fi
- ;OCL{{{ undeclares
- ( undeclare ( goto-window call-mouse-menu go-mouse-position handle-mouse ) )
- ;OCL}}}
- @fi
- ;OCL}}}
- ;OCL{{{ yes-no-menu
- ( defvar ( ynm-x ) )
- ( deffun ( force ) yes-no-menu
- ( do
- ( set ynm-x 0
- begin-prompt-macro
- menu-counter ynm-x ( I_NO " "/ " I_YES " " " history string-buffer )
- end-prompt-macro
- )
- while not(or(=(ynm-x 0) =(ynm-x 2)))
- if force
- ( if ynm-x ( insert-ascii I_YES ) else ( insert-ascii I_NO ) fi
- newline-and-indent
- )
- fi
- return-value-from-macro ynm-x
- )
- )
- ( undeclare ( ynm-x ) )
- ;OCL}}}
- ;OCL{{{ ref
- ;OCL{{{ set tags
- @if-using (NO-HELP-BROWSER)
- @use ( ModeOri-Reference-Card-REF )
- @fi
- @if-using not(NO-HELP-BROWSER)
- @use
- ( REF-TREE
- ModeOri-Reference-Card-REF
- ModeOri-Reference-Card-TREE
- C-Operators-TREE
- )
- @fi
- ;OCL}}}
- @lib modeori-fun/ref.ocl
- ;OCL{{{ reset tags
- @if-using (NO-HELP-BROWSER)
- @use not( ModeOri-Reference-Card-REF )
- @fi
- @if-using not(NO-HELP-BROWSER)
- @use not
- ( REF-TREE
- ModeOri-Reference-Card-REF
- ModeOri-Reference-Card-TREE
- C-Operators-TREE
- )
- @fi
- ;OCL}}}
- @if-using (NO-HELP-BROWSER)
- ( defmac mori-help ( help ) )
- ( defmac info ( mori-help ) )
- @fi
- @if-using not(NO-HELP-BROWSER)
- ;OCL{{{ info
- ( deffun info
- ( set prompting true
- ModeOri-Reference-Card
- set prompting false
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-help
- ( deffun mori-help
- ( if last-message M_ANY_Q ( ) fi
- screen-off
- history-edit string-buffer ()
- insert-ascii I_BACK
- beginning-of-line
- set ocl-argument store-character
- newline-and-indent
- help
- screen-on
- if last-message M_ANY_Q
- ;OCL{{{ show page
- ( insert-ascii ocl-argument )
- ;OCL}}}
- else
- ;OCL{{{ show mode dependent reference
- ( newline-and-indent
- case
- ;OCL{{{ language C -> operator hierarchy
- ( test-language C
- ( set prompting true
- C-Operators
- set prompting false
- )
- )
- ;OCL}}}
- default
- ;OCL{{{ reference data
- ( info )
- ;OCL}}}
- esac
- )
- ;OCL}}}
- fi
- )
- )
- ;OCL}}}
- ( undeclare ( ModeOri-Reference-Card C-Operators ) )
- @fi
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ edit mode macros
- ;OCL{{{ unmodified libs
- ;OCL{{{ xsel
- @if-using ( W-GET-X-SEL )
- @lib xsel
- @fi
- ;OCL}}}
- @lib trans-char
- @lib buff-chg
- @lib np-file
- ;OCL}}}
- ;OCL{{{ character-cases
- ;OCL{{{ toggle-case-word
- ( deffun toggle-case-word
- ( setup-char-sets
- ;OCL{{{ move to beginning of handled word
- if test-char-set word-char
- ( forward-character
- backward-word
- )
- else
- ( forward-word )
- fi
- ;OCL}}}
- if test-char-set word-char
- ;OCL{{{ handle word, move cursor behind
- ( do
- ;OCL{{{ maybe toggle single char
- ( if or
- ( =(0 modify-behaviour)
- and(<(0 modify-behaviour) test-char-set lower)
- and(>(0 modify-behaviour) test-char-set upper)
- )
- ( case-character-toggle )
- fi
- if =(2 modify-behaviour) ( set modify-behaviour -1 ) fi
- )
- ;OCL}}}
- while pre ( forward-character ) test-char-set word-char
- )
- ;OCL}}}
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ uppercase-word
- ( deffun uppercase-word
- ( set modify-behaviour 1
- toggle-case-word
- set modify-behaviour 0
- )
- )
- ;OCL}}}
- ;OCL{{{ capitalize-word
- ( deffun capitalize-word
- ( set modify-behaviour 2
- toggle-case-word
- set modify-behaviour 0
- )
- )
- ;OCL}}}
- ;OCL{{{ lowercase-word
- ( deffun lowercase-word
- ( set modify-behaviour -1
- toggle-case-word
- set modify-behaviour 0
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ error-buff
- ( demand-load
- ( @lib error-buff
- ;OCL{{{ redefine show-error-buffer for using prompting
- ( deffun e-m-show-error-buffer
- ( set prompting true
- show-error-buffer
- set prompting false
- )
- )
- ( undeclare ( show-error-buffer ) )
- ( defmac show-error-buffer ( e-m-show-error-buffer ) )
- ( undeclare ( e-m-show-error-buffer ) )
- ;OCL}}}
- )
- )
- ;OCL}}}
- ;OCL{{{ list-buffers
- ( demand-load ( @lib listbuff ) )
- ( deffun e-m-list-buffers
- ( set prompting true
- list-buffers
- set prompting false
- load-function not( list-buffers )
- )
- )
- ( undeclare ( list-buffers ) )
- ;OCL}}}
- ;OCL{{{ e-m-unfold
- ( deffun e-m-unfold-fold
- ( if not(in-prompt)
- ( case
- ( test-filed ( describe-fold toggle-file-fold ) )
- ( not(test-fold-line) ( close-fold ) )
- esac
- )
- fi
- unfold-fold
- )
- )
- ;OCL}}}
- ;OCL{{{ mode-position
- ;OCL{{{ prepare redefining mode-commands
- ( defvar ( show-position ) )
- ( defmac amp ( add-mode-position ) )
- ( defmac dmp ( delete-mode-position ) )
- ( undeclare ( add-mode-position delete-mode-position ) )
- ;OCL}}}
- ;OCL{{{ add-mode-position
- ( deffun add-mode-position ( set show-position 1 amp ) )
- ;OCL}}}
- ;OCL{{{ delete-mode-position
- ( deffun delete-mode-position ( set show-position 0 dmp ) )
- ;OCL}}}
- ;OCL{{{ toggle-mode-position
- ( deffun toggle-mode-position
- ( if show-position
- ( delete-mode-position )
- else
- ( add-mode-position )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ hide internal data
- ( undeclare ( amp dmp ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ toggle-mode-overwrite
- ( deffun toggle-mode-overwrite
- ( if test-overwrite
- ( delete-mode-overwrite )
- else
- ( add-mode-overwrite )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ buffer-handling
- ;OCL{{{ read the lib
- ( demand-load ( @lib file-buffers ) )
- ;OCL{{{ mori-dump-buffers-to-file
- ( deffun mori-dump-buffers-to-file
- ( delay-auto-save
- dump-buffers-to-file
- flush-auto-save
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-get-buffers-from-file
- ( deffun mori-get-buffers-from-file
- ( delay-auto-save
- get-buffers-from-file
- flush-auto-save
- )
- )
- ;OCL}}}
- ;OCL{{{ undeclares
- ( undeclare ( dump-buffers-to-file get-buffers-from-file ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ add-mode-buffer-save
- ( deffun add-mode-buffer-save ( set buff-saving 1 set-user-mode BS ) )
- ;OCL}}}
- ;OCL{{{ delete-mode-buffer-save
- ( deffun delete-mode-buffer-save ( set buff-saving 0 reset-user-mode BS ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ e-m-create-fold
- ( deffun e-m-create-fold
- (
- if and( extended-version not(test-folding) )
- ( switch-to-move-mode )
- else
- ( if highlight-off ( set modify-behaviour 5 ) fi
- create-fold
- set modify-behaviour 0
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-enter-fold
- @lib search-enter
- ( deffun e-m-enter-fold
- ( if extended-version
- ( set no-auto-change true
- search-and-enter-fold
- set no-auto-change false
- )
- else
- ( enter-fold )
- fi
- )
- )
- ( undeclare ( search-and-enter-fold ) )
- ;OCL}}}
- ;OCL{{{ e-m-save-file
- ( deffun e-m-save-file
- ( if set-enter
- ( local
- ( go-line-arg )
- ( set go-line-arg store-line
- exit-fold
- e-m-save-file
- if not(in-prompt)
- ( enter-fold
- go-line
- )
- fi
- )
- )
- else
- ( save-file )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ auto-indent
- ( defvar ( auto-indent ) )
- ;OCL{{{ add-mode-auto-indent
- ( deffun add-mode-auto-indent
- ( set auto-indent 1
- set-user-mode AI
- )
- )
- ;OCL}}}
- ;OCL{{{ delete-mode-auto-indent
- ( deffun delete-mode-auto-indent
- ( set auto-indent 0
- reset-user-mode AI
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-newline-and-indent
- ( deffun e-m-newline-and-indent
- ( if or(in-prompt >(auto-indent 0) not(test-text))
- ( newline-and-indent )
- else
- ( newline-and-indent
- "$
- goto-counter 1
- delspaces
- delete-character
- )
- fi
- do-mode-center
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ unchange-and-reread-file
- ( deffun unchange-and-reread-file
- ( case
- ( in-prompt ( ) )
- ( test-folding ( message ( M_NOFOLDKEY ) ) )
- default
- ( screen-off
- set-file-unchanged
- enter-list-file "0 newline-and-indent
- exit-fold
- screen-on
- redraw-display
- )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ mode-diredit-long
- ;OCL{{{ add-mode-diredit-long
- ( deffun add-mode-diredit-long
- ( set diredit-long 1
- if =(file-type 1)
- ( unchange-and-reread-file )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ delete-mode-diredit-long
- ( deffun delete-mode-diredit-long
- ( set diredit-long 0
- if =(file-type 1)
- ( unchange-and-reread-file )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ toggle-mode-diredit-long
- ( deffun toggle-mode-diredit-long
- ( set diredit-long -(1 diredit-long)
- if diredit-long
- ( message ( "[ "long " "directory " "mode! "] ) )
- else
- ( message ( "[ "short " "directory " "mode! "] ) )
- fi
- if =(file-type 1)
- ( unchange-and-reread-file )
- fi
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ fill-paragraph
- ( demand-load (
- @lib fillpara
- ;OCL{{{ e-m-fill-paragraph
- ( deffun e-m-fill-paragraph
- ( delete-mode-full-shift
- message ()
- if >(show-position 0)
- ( delete-mode-position
- fill-paragraph
- add-mode-position
- )
- else
- ( fill-paragraph )
- fi
- if full-shifting
- ( add-mode-full-shift
- message ()
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-set-fill-column
- ( deffun e-m-set-fill-column
- ( set prompting true
- set-fill-column
- set prompting false
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-set-fill-mode
- ( deffun e-m-set-fill-mode
- ( set prompting true
- set-fill-mode
- set prompting false
- )
- )
- ;OCL}}}
- ;OCL{{{ undeclares
- ( undeclare ( fill-paragraph ) )
- ;OCL}}}
- ) )
- ;OCL}}}
- ;OCL{{{ tags
- @use ( T-COMP O-T-FILE FE-G-T-BUFF S-N-I-T Q-U-G-T-BUFF I-T-FILE O-T-AFILE )
- @lib tags-mac
- @use not( T-COMP O-T-FILE FE-G-T-BUFF S-N-I-T Q-U-G-T-BUFF I-T-FILE O-T-AFILE )
- ( deffun e-m-find-or-enter-and-go-tags-buffer
- ( set prompting true
- find-or-enter-and-go-tags-buffer
- set prompting false
- )
- )
- ;OCL}}}
- ;OCL{{{ call-cmd
- ( deffun ( t ) call-cmd
- ( screen-off
- history-edit-filename shell ()
- ;OCL{{{ get change directory command
- local ()
- ( end-of-line
- ;OCL{{{ directories have to be handled in a special way!
- case
- ( =(file-type -1) ( beginning-of-line ) )
- ( =(file-type 1) ( insert-ascii path-separator ) )
- esac
- ;OCL}}}
- while true
- ( case
- ;OCL{{{ delete filename and gen 'cd dir;'
- ( test-char path-separator
- ( delete-to-end-of-line
- cmd-separator
- beginning-of-line
- cd-cmd " ;
- end-of-line
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ no cd needed
- ( test-begin-line
- ( delete-to-end-of-line
- return-from-macro
- )
- )
- ;OCL}}}
- default
- ( backward-character )
- esac
- )
- )
- ;OCL}}}
- case
- ( =(t 0) ( get-history make-cmd-hist 0 ) )
- ( >(t 0) ( get-history mail-cmd-hist 0 ) )
- esac
- newline-and-indent
- screen-on
- local
- ( force-bourne-shell )
- ( set force-bourne-shell true
- shell-command
- previous-line
- newline-and-indent
- )
- )
- )
- ;OCL}}}
- ;OCL{{{ call-make
- ( deffun call-make ( call-cmd(0) ) )
- ;OCL}}}
- ;OCL{{{ call-postbox
- ( deffun call-postbox ( call-cmd(1) ) )
- ;OCL}}}
- ;OCL{{{ e-m-filename-completion
- ( defvar ( f-c-verbose ) )
- ( deffun e-m-filename-completion
- (
- ;OCL{{{ prehandle verbose
- set f-c-verbose false
- if test-verbose
- ( set f-c-verbose true
- delete-mode-verbose
- )
- fi
- ;OCL}}}
- filename-completion
- if and(=(ocl-argument 0) not(in-prompt) extended-version)
- ( tag-completion )
- fi
- ;OCL{{{ posthandle verbose and maybe bell
- if f-c-verbose
- ( add-mode-verbose
- if =(ocl-argument 0)
- ( bell
- visible-bell
- )
- fi
- )
- fi
- ;OCL}}}
- )
- )
- ( undeclare ( f-c-verbose ) )
- ;OCL}}}
- ;OCL{{{ language-dependent extensions for '"..
- @if-using (L-EXT)
- ;OCL{{{ help vars
- ( defvar
- ( os-ext-help-1
- os-ext-help-2
- os-ext-help-3
- os-ext-help-4
- )
- )
- ;OCL}}}
- ;OCL{{{ c-bracket
- ( defmac c-bracket
- (
- @if-using (MY-C-CB)
- my-c-cb
- @fi
- @if-using not(MY-C-CB)
- ;OCL{{{ {} at right position
- set os-ext-help-1 store-pos
- beginning-of-line
- if test-char " ;
- ( goto-counter os-ext-help-1 )
- else
- ( set os-ext-help-1 store-pos
- if test-char "{ ( set os-ext-help-1 +(os-ext-help-1 2) ) fi
- end-of-line
- newline-and-indent
- goto-counter os-ext-help-1
- " ;
- )
- fi
- "{
- newline-and-indent
- "}
- previous-line
- " ;
- ;OCL}}}
- @fi
- )
- )
- ;OCL}}}
- ;OCL{{{ ocl-bracket
- ( defmac ocl-bracket
- ( set os-ext-help-1 store-pos
- beginning-of-line
- if test-char " ;
- ( goto-counter os-ext-help-1 )
- else
- ( set os-ext-help-1 store-pos
- if test-char "( ( set os-ext-help-1 +(os-ext-help-1 2) ) fi
- end-of-line
- newline-and-indent
- goto-counter os-ext-help-1
- " ;
- )
- fi
- "(
- newline-and-indent
- ")
- previous-line
- " ;
- )
- )
- ;OCL}}}
- ;OCL{{{ p-bracket
- ( defmac p-bracket
- (
- @if-using (MY-P-CB)
- my-p-cb
- @fi
- @if-using not(MY-P-CB)
- ;OCL{{{ begin/end at right position
- set os-ext-help-1 store-pos
- beginning-of-line
- if not(test-char " )
- ( set os-ext-help-1 store-pos
- end-of-line
- newline-and-indent " " ;
- )
- else
- ( goto-counter os-ext-help-1 )
- fi
- "begin
- newline-and-indent
- newline-and-indent
- "end
- previous-line
- backward-character
- ;OCL}}}
- @fi
- )
- )
- ;OCL}}}
- ;OCL{{{ parens
- ( deffun paired-parens
- ( "(
- if
- and
- ( >(extended-version 0)
- not(in-prompt)
- or
- ( test-language Pascal
- test-language C
- test-language Occam
- test-language Inmos
- test-language TeX
- eval ( test-language-ocl )
- )
- )
- ( ") backward-character )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ brackets
- ( deffun paired-brackets
- ( "[
- if
- and
- ( >(extended-version 0)
- not(in-prompt)
- or
- ( test-language Pascal
- test-language C
- test-language Occam
- test-language Inmos
- )
- )
- ( "] backward-character )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ curly brackets
- ( deffun paired-curly-brackets
- ( case
- (not(>(extended-version 0))())
- (in-prompt ())
- (not(test-text) ())
- ;OCL{{{ c-mode
- ( test-language C ( c-bracket return-from-macro ) )
- ;OCL}}}
- ;OCL{{{ p-mode
- ( test-language Pascal ( p-bracket return-from-macro ) )
- ;OCL}}}
- ;OCL{{{ occam
- ( or(test-language Inmos test-language Occam)
- ( end-of-line
- newline-and-indent
- "SEQ
- newline-and-indent
- " " ;
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ ocl
- ( eval ( test-language-ocl ) ( ocl-bracket return-from-macro ) )
- ;OCL}}}
- esac
- "{
- )
- )
- ;OCL}}}
- ;OCL{{{ doublequotes
- ( deffun doublequotes
- ( ""
- if and
- ( >(extended-version 0)
- not(in-prompt)
- )
- ( case
- ( or
- ( test-language Pascal
- test-language C
- test-language Occam
- test-language Inmos
- )
- ( "" backward-character )
- )
- ( eval ( test-language-ocl )
- ( " backward-character )
- )
- esac
- )
- fi
- ))
- ;OCL}}}
- ;OCL{{{ singlequotes
- ( deffun singlequotes
- ( "'
- if
- and
- ( >(extended-version 0)
- not(in-prompt)
- or
- ( test-language Pascal
- test-language C
- test-language Occam
- test-language Inmos
- )
- )
- ( "' backward-character )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ semicolon
- ( deffun semicolon
- ( if
- and
- ( >(extended-version 0)
- not(in-prompt)
- test-text
- )
- ( case
- ;OCL{{{ c or pascal
- ( or
- ( test-language C
- test-language Pascal
- )
- @if-using (MY-L-SEMICOLON)
- ( my-l-semicolon )
- @fi
- @if-using not(MY-L-SEMICOLON)
- ;OCL{{{ language
- (
- ;OCL{{{ gen ; at correct position
- set os-ext-help-1 store-pos
- beginning-of-line
- if test-char " ;
- ( goto-counter os-ext-help-1
- ";
- )
- else
- ( end-of-line
- backward-character
- if not(test-char "; ) ( forward-character "; ) fi
- )
- fi
- ;OCL}}}
- ;OCL{{{ where must next line begin
- beginning-of-line
- set os-ext-help-1 store-pos
- if and(test-language C test-char "{)
- ( set os-ext-help-1 +(os-ext-help-1 2) )
- fi
- ;OCL}}}
- next-line
- beginning-of-line
- if test-char " ;
- ;OCL{{{ empty line, move to position
- ( goto-counter os-ext-help-1 )
- ;OCL}}}
- else
- ;OCL{{{ maybe generate new line
- ( set os-ext-help-2 os-ext-help-1
- set os-ext-help-1 -(os-ext-help-1 store-pos)
- if or(not(test-text) >(os-ext-help-1 0))
- ( previous-line
- end-of-line
- newline-and-indent
- goto-counter os-ext-help-2
- )
- fi
- )
- ;OCL}}}
- fi
- return-from-macro
- )
- ;OCL}}}
- @fi
- )
- ;OCL}}}
- ;OCL{{{ OCL
- ( eval ( test-language-ocl )
- (
- ;OCL{{{ where must next line begin
- beginning-of-line
- set os-ext-help-1 store-pos
- if test-char "(
- ( set os-ext-help-1 +(os-ext-help-1 2) )
- fi
- ;OCL}}}
- next-line
- beginning-of-line
- if test-char " ;
- ;OCL{{{ empty line, move to position
- ( goto-counter os-ext-help-1 )
- ;OCL}}}
- else
- ;OCL{{{ maybe generate new line
- ( set os-ext-help-2 os-ext-help-1
- set os-ext-help-1 -(os-ext-help-1 store-pos)
- if or(not(test-text) >(os-ext-help-1 0))
- ( previous-line
- end-of-line
- newline-and-indent
- goto-counter os-ext-help-2
- )
- fi
- )
- ;OCL}}}
- fi
- return-from-macro
- )
- )
- ;OCL}}}
- esac
- )
- fi
- ";
- )
- )
- ;OCL}}}
- ;OCL{{{ language-struct
- ( demand-load (
- ( deffun language-struct
- (
- if test-text
- ( para
- set os-ext-help-1 0
- menu-counter os-ext-help-1 ( "none " "for " "while-do " "do-while " "case )
- edit
- case
- (=(os-ext-help-1 0) ( return-from-macro ) )
- ;OCL{{{ for statement
- ( pre ( set os-ext-help-1 -(os-ext-help-1 1) ) =(os-ext-help-1 0)
- ( case
- ;OCL{{{ C
- ( test-language C
- ( "for " paired-parens "; "; c-bracket
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ PASCAL
- ( test-language Pascal
- ( "for " "to p-bracket
- return-from-macro
- )
- )
- ;OCL}}}
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ while statement
- ( pre ( set os-ext-help-1 -(os-ext-help-1 1) ) =(os-ext-help-1 0)
- ( case
- ;OCL{{{ OCL
- ( eval ( test-language-ocl )
- ( "while
- ocl-bracket
- return-from-macro
-
- )
- )
- ;OCL}}}
- ;OCL{{{ C
- ( test-language C
- ( "while " "( ") c-bracket
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ PASCAL
- ( test-language Pascal
- ( "while " "do p-bracket
- return-from-macro
- )
- )
- ;OCL}}}
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ do statement
- ( pre ( set os-ext-help-1 -(os-ext-help-1 1) ) =(os-ext-help-1 0)
- ( case
- ;OCL{{{ OCL
- ( eval ( test-language-ocl )
- ( set os-ext-help-3 store-pos
- "do
- ocl-bracket
- set os-ext-help-4 store-pos
- next-line
- end-of-line
- newline-and-indent
- goto os-ext-help-3
- "while
- previous-line
- previous-line
- goto os-ext-help-4
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ C
- ( test-language C
- ( set os-ext-help-3 store-pos
- "do
- c-bracket
- set os-ext-help-4 store-pos
- next-line
- end-of-line
- newline-and-indent
- goto os-ext-help-3
- "while " "( ") ";
- previous-line
- previous-line
- goto os-ext-help-4
- return-from-macro
- )
- )
- ;OCL}}}
- ;OCL{{{ Pascal
- ( test-language Pascal
- ( set os-ext-help-3 store-pos
- "repeat
- p-bracket
- set os-ext-help-4 store-pos
- next-line
- end-of-line
- newline-and-indent
- goto os-ext-help-3
- "until
- previous-line
- previous-line
- goto os-ext-help-4
- return-from-macro
- )
- )
- ;OCL}}}
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ case statement
- ( pre ( set os-ext-help-1 -(os-ext-help-1 1) ) =(os-ext-help-1 0)
- ( case
- ;OCL{{{ C
- ( test-language C
- ( "switch " "( ") c-bracket
- return-from-macro
- )
- )
- ;OCL}}}
- esac
- )
- )
- ;OCL}}}
- esac
- )
- fi
- message ( "not " "supported )
- )
- )
- ) )
- ;OCL}}}
- ;OCL{{{ undeclare help vars
- ( undeclare
- ( os-ext-help-1
- os-ext-help-2
- os-ext-help-3
- os-ext-help-4
- c-bracket
- p-bracket
- )
- )
- ;OCL}}}
- @fi
- ;OCL}}}
- ;OCL{{{ highlighting
- ( deffun add-mode-highlight ( set highlight-off 0 ) )
- ( deffun delete-mode-highlight ( set highlight-off 1 ) )
- ;OCL}}}
- ;OCL{{{ mode-parse
- ( defmac add-mode-parse ( delete-mode-no-parse ) )
- ( defmac delete-mode-parse ( add-mode-no-parse ) )
- ;OCL}}}
- ;OCL{{{ exit-origami
- ( deffun exit-origami
- ( if >(used-buffers 1)
- ( screen-off )
- fi
- while not(test-file-changed)
- ( exit-buffer
- if =(used-buffers 1)
- ( screen-on
- redraw-display
- )
- fi
- )
- screen-on
- redraw-display
- message ( "file " "changed )
- )
- )
- ;OCL}}}
- ;OCL{{{ fold-mark-menu
- ( demand-load (
- ( deffun fold-mark-menu
- ( if test-folding ( return-from-macro ) fi
- set cmd-in 1
- para
- menu-counter cmd-in ( "Ok " "Default " "Pascal " "Script " "New)
- edit
- case
- ;OCL{{{ 0 -> nothing to do
- ( =(cmd-in 0) ( ) )
- ;OCL}}}
- ;OCL{{{ 1 -> default
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( change-fold-mark
- newline-and-indent
- newline-and-indent
- newline-and-indent
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ 2 -> pascal
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( change-fold-mark "<<<:::...>>> )
- )
- ;OCL}}}
- ;OCL{{{ 3 -> script
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( change-fold-mark "##@##:...##$ )
- )
- ;OCL}}}
- ;OCL{{{ 4 -> new
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( change-fold-mark return-from-macro )
- )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- message ( )
- )
- )
- ) )
- ;OCL}}}
- ;OCL{{{ spell
- ( demand-load
- (
- ;OCL{{{ mode spell-pause
- ( defmodestring SP "SpellPause "SpellPause )
- ;OCL}}}
- @use ( PRE-SPELL-EDIT-COMMAND )
- ;OCL{{{ pre-spell-edit-command
- ( defmac pre-spell-edit-command
- ( set prompting false
- set-user-mode SP
- message-exit ( "[ "spell " "suspended " "for " "editing, " "use " "spell-buffer " "to " "continue "] )
- )
- )
- ;OCL}}}
- @lib spell
- @use not( PRE-SPELL-EDIT-COMMAND )
- ;OCL{{{ e-m-spell-buffer
- ( deffun e-m-spell-buffer
- ( set prompting true
- reset-user-mode SP
- spell-buffer
- set prompting false
- load-function not( spell-buffer )
- )
- )
- ;OCL}}}
- ( undeclare ( pre-spell-edit-command ) )
- )
- )
- ;OCL}}}
- ;OCL{{{ main-menu
- ;OCL{{{ str-get
- ( demand-load (
- ( deffun str-get
- ( set prompting true
- while true
- ( begin-prompt-macro
- prompt-char-counter cmd-in ()
- end-prompt-macro
- if =(cmd-in newline-and-indent)
- ( end-of-line
- set prompting false
- return-from-macro
- )
- fi
- insert-ascii cmd-in
- )
- )
- )
- ) )
- ;OCL}}}
- ;OCL{{{ para-menu
- ( demand-load (
- ;OCL{{{ cur-val-start
- ( defmac cur-val-start ( "( insert-ascii C-? ) )
- ;OCL}}}
- ;OCL{{{ cur-val-end
- ( deffun cur-val-end
- ( backward-character
- while not(test-char C-?)
- ( if test-char " ;
- ( raw-delete-character
- "_
- backward-character
- )
- fi
- backward-character
- )
- raw-delete-character
- end-of-line
- ")
- )
- )
- ;OCL}}}
- ;OCL{{{ file-para-menu
- ( deffun file-para-menu
- ( if test-view ( message ( M_VIEW ) view-macro ) fi
- set cmd-in 1
- para
- menu-counter
- cmd-in
- ( "Ok
- " "Language
- " "Fold-marks
- )
- edit
- show-cursor 0
- case
- ( =(cmd-in 0) ( ) )
- ;OCL{{{ set-language
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( set-language ) )
- ;OCL}}}
- ;OCL{{{ fold-marks
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( fold-mark-menu ) )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ diredit-para-menu
- ( deffun diredit-para-menu
- ( set cmd-in 0
- ;OCL{{{ get menu string
- screen-off
- history-edit string-buffer ()
- "Ok
- " "ToggleLong
- ;OCL{{{ match
- " "Match
- cur-val-start
- get-history match 0
- cur-val-end
- ;OCL}}}
- ;OCL{{{ nomatch
- " "NoMatch
- cur-val-start
- get-history no-match 0
- cur-val-end
- ;OCL}}}
- newline-and-indent
- screen-on
- ;OCL}}}
- para
- menu-counter cmd-in ( history string-buffer )
- edit
- show-cursor 0
- case
- ( =(cmd-in 0) ( ) )
- ;OCL{{{ toggle long diredit
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( toggle-mode-diredit-long ) )
- ;OCL}}}
- ;OCL{{{ match
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit match "match
- str-get
- if test-begin-line ( ". ) fi
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ nomatch
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit no-match "no-match
- str-get
- if test-begin-line ( insert-ascii path-separator ) fi
- newline-and-indent
- )
- )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ command-para-menu
- ( deffun command-para-menu
- ( set cmd-in 0
- ;OCL{{{ get menu string
- screen-off
- history-edit string-buffer ()
- "Ok
- ;OCL{{{ spell
- " "Spell
- cur-val-start
- get-history spell-command 0
- cur-val-end
- ;OCL}}}
- ;OCL{{{ make
- " "Make
- cur-val-start
- get-history make-cmd-hist 0
- cur-val-end
- ;OCL}}}
- @if-using ( SHELL-MODE )
- ;OCL{{{ nn
- " "Nn
- cur-val-start
- get-history I-nn-cmd 0
- cur-val-end
- ;OCL}}}
- @fi
- ;OCL{{{ postbox
- " "Postbox
- cur-val-start
- get-history mail-cmd-hist 0
- cur-val-end
- ;OCL}}}
- ;OCL{{{ tags
- " "TagsFile
- cur-val-start
- get-history tags-file 0
- cur-val-end
- ;OCL}}}
- @if-using ( SHELL-MODE )
- if not(ocl-arg-field(15))
- ;OCL{{{ shell
- ( " "EnableShell )
- ;OCL}}}
- fi
- @fi
- newline-and-indent
- screen-on
- ;OCL}}}
- para
- menu-counter cmd-in ( history string-buffer )
- edit
- show-cursor 0
- case
- ( =(cmd-in 0) ( ) )
- ;OCL{{{ spell
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit spell-command "spell-command
- str-get
- if test-begin-line
- ( default-spell-command )
- fi
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ make
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit make-cmd-hist "make-command
- str-get
- if test-begin-line
- ( make-cmd-def )
- fi
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ nn
- @if-using ( SHELL-MODE )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit I-nn-cmd "nn-command
- str-get
- if test-begin-line
- ( nn-cmd-def )
- fi
- newline-and-indent
- )
- )
- @fi
- ;OCL}}}
- ;OCL{{{ postbox
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit mail-cmd-hist "postbox-command
- str-get
- if test-begin-line
- ( mail-cmd-def )
- fi
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ tags
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( history-edit tags-file "tags-file
- str-get
- set tags-user-tags-file true
- if test-begin-line
- ( "default
- set tags-user-tags-file false
- )
- fi
- newline-and-indent
- )
- )
- ;OCL}}}
- ;OCL{{{ shell
- @if-using ( SHELL-MODE )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( add-mode-shell ) )
- @fi
- ;OCL}}}
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL}}}
- ) )
- ( defmac para-menu
- ( set-user-mode PM
- set cmd-in 1
- para
- menu-counter
- cmd-in
- ( "Ok
- " "FileParameter
- " "DirEdit
- " "CommandParameter
- " "set-display-mode
- )
- edit
- reset-user-mode PM
- show-cursor 0
- case
- ( =(cmd-in 0) ( ) )
- ;OCL{{{ set-language
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( file-para-menu ) )
- ;OCL}}}
- ;OCL{{{ diredit-filter
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( diredit-para-menu ) )
- ;OCL}}}
- ;OCL{{{ command
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( command-para-menu ) )
- ;OCL}}}
- ;OCL{{{ set-display-mode
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( set-display-mode ) )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- ;OCL{{{ unload inernal functions
- load-function not
- ( file-para-menu
- diredit-para-menu
- command-para-menu
- cur-val-end
- )
- ;OCL}}}
- )
- )
- ;OCL{{{ undeclares
- ( undeclare
- ( file-para-menu
- cur-val-start
- cur-val-end
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ file-menu
- ( defmac file-menu
- ( set-user-mode FM
- set cmd-in 1
- para
- menu-counter
- cmd-in
- ( "Ok
- " "Save
- " "Unchange
- " "Read
- " "Insert
- " "List-of-edited-files
- )
- edit
- reset-user-mode FM
- case
- ( =(cmd-in 0) ( ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( save-file ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( set-file-unchanged ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( read-file ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( insert-file ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( read-list-file "0 newline-and-indent )
- )
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ mode-menu
- ( defmac mode-menu
- ( set-user-mode TM
- set cmd-in 0
- para
- menu-counter
- cmd-in
- ( "Ok
- " "View
- " "Extend
- " "Autosave
- " "Write-over
- " "Position
- )
- edit
- case
- ( =(cmd-in 0) ( ) )
- ;OCL{{{ toggle view
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( if test-view ( delete-mode-view ) else ( add-mode-view ) fi )
- )
- ;OCL}}}
- ;OCL{{{ toggle extend
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( case
- ( =(extended-version 0) ( delete-mode-extended ) )
- ( >(extended-version 0) ( set-mode-raw ) )
- default
- ( add-mode-extended )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ toggle autosave
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( if test-autosave
- ( delete-mode-autosave )
- else
- ( add-mode-autosave newline-and-indent )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ toggle overwrite
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( toggle-mode-overwrite ) )
- ;OCL}}}
- ;OCL{{{ toggle position
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( toggle-mode-position ) )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- reset-user-mode TM
- )
- )
- ;OCL}}}
- @if-using ( SHELL-MODE ) ( forward shell-exit-origami ) @fi
- ( deffun main-menu
- ( if in-prompt ( newline-and-indent return-from-macro ) fi
- set cmd-in 1
- para
- menu-counter
- cmd-in
- ( "Ok
- " "Bindings
- @if-using not( NO-HELP-BROWSER ) " "Info @fi
- " "Help
- " "File
- " "MoveMode
- " "Para
- " "ToggleModes
- " "Window
- " "Exit
- )
- edit
- case
- (=(cmd-in 0) ( message ( ) ) )
- ;OCL{{{ describe-bindings
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( describe-bindings ) )
- ;OCL}}}
- ;OCL{{{ info
- @if-using not( NO-HELP-BROWSER )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( set prompting true
- info
- set prompting false
- )
- )
- @fi
- ;OCL}}}
- ;OCL{{{ help
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( mori-help ) )
- ;OCL}}}
- ;OCL{{{ file
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( file-menu ) )
- ;OCL}}}
- ;OCL{{{ move
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( switch-to-move-mode ) )
- ;OCL}}}
- ;OCL{{{ para
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( para-menu ) )
- ;OCL}}}
- ;OCL{{{ mode
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( mode-menu ) )
- ;OCL}}}
- ;OCL{{{ buffer
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( switch-on-buffer-handling
- b-m-menu
- )
- )
- ;OCL}}}
- ;OCL{{{ exit
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- (
- ;OCL{{{ set prompt for really exit
- screen-off
- history-edit string-buffer ()
- "really " "leave " "editing
- newline-and-indent
- screen-on
- ;OCL}}}
- if eval ( yes-no-menu(false))
- ( @if-using ( SHELL-MODE ) shell-exit-origami @fi
- @if-using not( SHELL-MODE ) exit-origami @fi
- )
- fi
- )
- )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL{{{ undeclares
- ( undeclare ( mode-menu file-menu para-menu str-get ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ e-m-delete-to-end-of-line
- ( defvar ( d2eol-x ) )
- ( deffun e-m-delete-to-end-of-line
- ( if and(not(in-prompt) or(test-fold-line test-filed))
- ( set d2eol-x store-pos
- beginning-of-line
- if <=(d2eol-x store-pos)
- ( delete-line
- goto d2eol-x
- return-from-macro
- )
- fi
- goto d2eol-x
- )
- fi
- delete-to-end-of-line
- )
- )
- ;OCL}}}
- ;OCL{{{ extend some simple commands for open-fold-lines
- ;OCL{{{ front-fold-action
- ( defvar ( action action-pos ) )
- ( deffun front-fold-action
- ( if and(not(in-prompt) or(test-begin-fold test-end-fold))
- ( set action-pos store-pos
- beginning-of-line
- if not(>(-(action-pos store-pos) 0))
- ( if test-end-fold
- ( set action-pos cursor-level )
- else
- ( set action-pos 0 )
- fi
- screen-off
- close-fold
- if =(action delete-character)
- ( set action delete-previous-character )
- fi
- insert-ascii action
- open-fold
- if action-pos ( mtool-bot set-cursor-line action-pos ) fi
- do-mode-center
- screen-on
- redraw-display
- return-from-macro
- )
- fi
- goto-counter action-pos
- )
- fi
- insert-ascii action
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-wrap-word
- ( deffun e-m-wrap-word
- ( set action execute-number-macro wrap-word
- front-fold-action
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-delete-character
- ( deffun e-m-delete-character
- ( set action delete-character
- front-fold-action
- )
- )
- ;OCL}}}
- ;OCL{{{ e-m-delete-previous-character
- ( deffun e-m-delete-previous-character
- ( set action delete-previous-character
- front-fold-action
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ move mode macros
- ;OCL{{{ move-mode status vars
- ( defvar
- ( was-view ; was in view-mode
- edit-over ; store old overwrite-status for complex commands
- )
- )
- ;OCL}}}
- ;OCL{{{ select-no-highlight
- ( deffun select-no-highlight
- ( if and(test-folding <>(ocl-argument 0)) ( create-fold ) fi )
- )
- ;OCL}}}
- ;OCL{{{ select-highlight
- ( deffun select-highlight
- ( set modify-behaviour -2
- if highlight-off ( set modify-behaviour -4 ) fi
- create-fold
- set modify-behaviour 0
- )
- )
- ;OCL}}}
- ;OCL{{{ m-m-goto-line
- ( deffun m-m-goto-line
- ( para
- prompt-counter go-line-arg ( M_GOTO "? " )
- moves
- go-line
- )
- )
- ;OCL}}}
- ;OCL{{{ store-move-modes
- ( defmac store-move-modes
- (
- ;OCL{{{ store view
- set was-view counter test-view
- ;OCL}}}
- ;OCL{{{ store overwrite
- set edit-over false
- if test-overwrite
- ( set edit-over true
- delete-mode-overwrite
- )
- fi
- ;OCL}}}
- select-highlight
- )
- )
- ;OCL}}}
- ;OCL{{{ restore-move-modes
- ( defmac restore-move-modes
- (
- ;OCL{{{ restore view
- if was-view ( add-mode-view ) fi
- ;OCL}}}
- ;OCL{{{ restore overwrite
- if edit-over ( add-mode-overwrite ) fi
- ;OCL}}}
- select-no-highlight
- )
- )
- ;OCL}}}
- ;OCL{{{ read the lib
- @use (REGIONS-INDENT) @lib regions @use not(REGIONS-INDENT)
- ;OCL}}}
- ;OCL{{{ m-m-set-start-mark
- ( deffun m-m-set-start-mark
- ( select-no-highlight
- set-start-mark
- select-highlight
- )
- )
- ;OCL}}}
- ;OCL{{{ change-position
- ( deffun change-position
- ( select-no-highlight
- set-end-mark
- select-highlight
- go-start-mark
- change-mark-counters
- )
- )
- ;OCL}}}
- ;OCL{{{ region/buffer support macros
- ;OCL{{{ fold-error
- ( deffun fold-error
- ( if was-view ( add-mode-view ) fi
- bell
- visible-bell
- switch-to-edit-mode
- screen-on
- redraw-display
- message-exit ( "[ M_FOLDERR ", " "switch " "to " "edit-mode "] )
- )
- )
- ;OCL}}}
- ;OCL{{{ mov-check-view
- ( deffun mov-check-view
- ( if test-view ( " ) else ( select-no-highlight ) fi )
- )
- ;OCL}}}
- ;OCL{{{ pretty-move-exit
- ( deffun pretty-move-exit
- ( set command 1
- screen-on
- redraw-display
- switch-to-edit-mode
- )
- )
- ;OCL}}}
- ;OCL{{{ handle-fold-op-join
- ( deffun ( op ) handle-fold-op-join
- ( mov-check-view
- screen-off
- set-end-mark
- fold-region
- if folderr ( fold-error ) fi
- insert-ascii op
- if and(start-splitted end-splitted)
- ( combine-splitted-parts-start )
- fi
- pretty-move-exit
- )
- )
- ;OCL}}}
- ;OCL{{{ in-at-position
- ;OCL{{{ splitt-put-line
- ( defvar ( y cy ) )
- ( defmac splitt-put-line
- ( if test-text
- ;OCL{{{ maybe splitt the text-line
- (
- if and(test-text,
- ;OCL{{{ cursor inside a line
- or(test-end-line,
- pre
- ( set y store-pos
- beginning-of-line
- set cy store-pos
- goto-counter y
- )
- >(store-pos cy)
- )
- ;OCL}}}
- )
- ;OCL{{{ splitt
- ( set start-x store-pos
- set start-y store-line
- newline-and-indent
- set end-x store-pos
- set end-y store-line
- )
- ;OCL}}}
- else
- ;OCL{{{ don't splitt
- ( set start-y 0 )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- else
- ;OCL{{{ else unkill before the line
- ( beginning-of-line
- set start-y 0
- )
- ;OCL}}}
- fi
- )
- )
- ( undeclare ( y cy ) )
- ;OCL}}}
- ;OCL{{{ variables
- ( defvar ( in-line in-mark ) )
- ;OCL}}}
- ( deffun ( in-op ) in-at-position
- ( mov-check-view
- if not(test-text)
- ( switch-to-edit-mode
- return-from-macro
- )
- fi
- screen-off
- splitt-put-line
- ;OCL{{{ store information to check empty inserts
- set in-mark store-line-mark
- set in-line store-line
- ;OCL}}}
- insert-ascii in-op
- ;OCL{{{ check and maybe add empty insert
- goto-line-mark in-mark
- if =(in-line store-line)
- ( create-fold
- create-fold
- beginning-of-line
- )
- else
- ( previous-line )
- fi
- ;OCL}}}
- ;OCL{{{ get new end position, maybe remove fold around insert
- next-line
- set end-y store-line
- previous-line
- if test-fold-line
- ( unfold-fold
- set end-y -(end-y 2)
- )
- fi
- ;OCL}}}
- if start-y
- ;OCL{{{ maybe join lines
- ( if test-text
- ( beginning-of-line
- "$
- previous-line
- end-of-line
- while test-char " ( raw-delete-character )
- raw-delete-character
- if not(test-char " ) ( " ) fi
- set end-y -(end-y 1)
- )
- fi
- ;OCL{{{ go-line end-y
- set go-line-arg end-y
- go-line
- ;OCL}}}
- previous-line
- if test-text
- ;OCL{{{ combine lines
- ( next-line
- goto-counter end-x
- "$
- previous-line
- end-of-line
- while test-char " ( delete-character )
- delete-character " ;
- )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- fi
- pretty-move-exit
- )
- )
- ;OCL{{{ undeclares
- ( undeclare ( in-line in-mark splitt-put-line ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ handle-copy-op
- ( deffun ( type ) handle-copy-op
- ( if >(type 0) ( select-no-highlight ) else ( mov-check-view ) fi
- screen-off
- set-end-mark
- ;OCL{{{ fold
- fold-region
- if folderr ( fold-error ) fi
- ;OCL}}}
- case
- ;OCL{{{ type=0 -> double region
- ( =(type 0)
- ( double-line
- unfold-fold
- previous-line
- )
- )
- ;OCL}}}
- ;OCL{{{ type>0 -> copy kill region
- ( >(type 0)
- ( enter-fold
- while not(test-bottom)
- ( copy-to-kill-buffer
- next-line
- )
- exit-fold
- )
- )
- ;OCL}}}
- default
- ;OCL{{{ change case
- ( enter-fold
- while not(test-bottom)
- ( goto 1
- while not(test-end-line)
- ( if
- or
- ( =(type -1)
- and(=(type -2) test-char-set upper)
- and(=(type -3) test-char-set lower)
- )
- ( case-character-toggle )
- fi
- forward-character
- )
- next-line
- open-fold
- )
- exit-fold
- )
- ;OCL}}}
- esac
- unfold-fold
- ;OCL{{{ maybe combine splitted start
- if start-splitted ( combine-splitted-parts-start ) fi
- ;OCL}}}
- ;OCL{{{ maybe combine both splitted ends
- if end-splitted
- ;OCL{{{ combine both end-lines
- ( combine-splitted-parts-end
- if =(type 0)
- ;OCL{{{ double region, so two parts to combine!
- ( set end-y +(end-y -(end-y start-y))
- ;OCL{{{ go-line end-y
- set go-line-arg end-y
- go-line
- ;OCL}}}
- end-of-line
- set end-x store-pos
- combine-splitted-parts-end
- )
- ;OCL}}}
- fi
- )
- ;OCL}}}
- fi
- ;OCL}}}
- pretty-move-exit
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ kill-mark-region
- ;OCL{{{ kill-all
- ( deffun kill-all
- (
- ;OCL{{{ kill all lines
- enter-fold
- while not(test-bottom)
- ( kill-line )
- exit-fold
- ;OCL}}}
- unfold-fold
- )
- )
- ;OCL}}}
- ( deffun kill-mark-region ( handle-fold-op-join(kill-all) ) )
- ;OCL{{{ undeclares
- ( undeclare ( kill-all ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ delete-mark-region
- ( deffun delete-mark-region ( handle-fold-op-join(delete-line) ) )
- ;OCL}}}
- ;OCL{{{ toggle-case-mark-region
- ( deffun toggle-case-mark-region ( handle-copy-op(-1) ) )
- ;OCL}}}
- ;OCL{{{ lowercase-mark-region
- ( deffun lowercase-mark-region ( handle-copy-op(-2) ) )
- ;OCL}}}
- ;OCL{{{ uppercase-mark-region
- ( deffun uppercase-mark-region ( handle-copy-op(-3) ) )
- ;OCL}}}
- ;OCL{{{ copy-mark-region
- ( deffun copy-mark-region ( handle-copy-op(0) ) )
- ;OCL}}}
- ;OCL{{{ copy-kill-mark-region
- ;OCL{{{ variables
- ( defvar ( ckmr-x ckmr-l was-changed ) )
- ;OCL}}}
- ( deffun copy-kill-mark-region
- ( if was-view ( delete-mode-view ) fi
- ;OCL{{{ store change-status
- set was-changed counter test-file-changed
- ;OCL}}}
- ;OCL{{{ save position
- set ckmr-l cursor-level
- set go-line-arg store-line
- set ckmr-x store-pos
- ;OCL}}}
- local
- ( go-line-arg )
- ( handle-copy-op(1) )
- ;OCL{{{ restore-position
- screen-off
- go-line
- goto ckmr-x
- screen-on
- set-cursor-line ckmr-l
- ;OCL}}}
- ;OCL{{{ maybe set file unchanged again
- if not(was-changed)
- ( set-file-unchanged )
- fi
- ;OCL}}}
- if was-view ( add-mode-view ) fi
- )
- )
- ;OCL{{{ undeclares
- ( undeclare ( ckmr-x ckmr-l was-changed ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ fold-mark-region
- ( deffun fold-mark-region
- ( mov-check-view
- screen-off
- set-end-mark
- ;OCL{{{ create the fold
- if and(=(start-x end-x) =(start-y end-y))
- ( create-fold create-fold )
- else
- ( fold-region
- if folderr ( fold-error ) fi
- )
- fi
- ;OCL}}}
- pretty-move-exit
- )
- )
- ;OCL}}}
- ;OCL{{{ undo-delete-line-unfolded-at-position
- ( deffun undo-delete-line-unfolded-at-position
- ( in-at-position(undo-delete-line) )
- )
- ;OCL}}}
- ;OCL{{{ unkill-unfolded-at-position
- ( deffun unkill-unfolded-at-position
- ( in-at-position(insert-folded-kill-buffer) )
- )
- ;OCL}}}
- ;OCL{{{ move-mark-region
- ;OCL{{{ move-maybe-unfolded
- ( deffun move-maybe-unfolded
- ( if =(start-y end-y) ( unfold-fold ) fi
- move-line
- )
- )
- ;OCL}}}
- ;OCL{{{ move-fold-next
- ( deffun move-fold-next
- ( move-line
- beginning-of-line
- create-fold
- next-line
- create-fold
- next-line
- )
- )
- ;OCL}}}
- ( deffun move-mark-region
- ( if move-count
- ( in-at-position(move-fold-next) )
- else
- ( handle-fold-op-join(move-maybe-unfolded) )
- fi
- )
- )
- ;OCL{{{ undeclares
- ( undeclare ( move-maybe-unfolded ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ indent-region macros
- ( demand-load (
- ;OCL{{{ variables
- ( defvar ( irsx irsy irex irey ir-help ) )
- ;OCL}}}
- ;OCL{{{ indent-region-sub
- ( deffun ( width ) indent-region-sub
- ( mv-indent
- reset-user-mode MV
- set-user-mode SH
- if command
- ;OCL{{{ restore positions, maybe gen error on change
- ( set start-x irsx
- set start-y irsy
- set end-x irex
- set end-y irey
- )
- ;OCL}}}
- else
- ;OCL{{{ store positions
- ( mov-check-view
- set-end-mark
- set irsx start-x
- set irsy start-y
- set irex end-x
- set irey end-y
- if >(irey irsy)
- ( set irline start-line )
- else
- ( set irline end-line )
- fi
- )
- ;OCL}}}
- fi
- screen-off
- ;OCL{{{ pre handle highlight
- select-no-highlight
- ;OCL}}}
- ;OCL{{{ indent
- set folderr false
- indent-region( width )
- ;OCL}}}
- ;OCL{{{ post handle highlight
- set ir-help store-pos
- repeat screen-height
- ( next-line )
- if >(store-line end-y)
- ( set go-line-arg end-y
- go-line
- )
- fi
- next-line
- set modify-behaviour -1
- if highlight-off ( set modify-behaviour -4 ) fi
- create-fold
- set modify-behaviour 0
- go-start-mark
- goto ir-help
- ;OCL}}}
- screen-on
- set-cursor-line irline
- if folderr
- ( switch-to-edit-mode )
- else
- ( set command 1 )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ shift-in-region
- ( deffun shift-in-region ( indent-region-sub( 1 ) ) )
- ;OCL}}}
- ;OCL{{{ shift-out-region
- ( deffun shift-out-region ( indent-region-sub( -1 ) ) )
- ;OCL}}}
- ;OCL{{{ shift-x-region
- ( deffun shift-x-region
- ( para
- prompt-counter cmd-in ( "shift-width-spaces "? " )
- indent-region-sub( cmd-in )
- )
- )
- ;OCL}}}
- ;OCL{{{ shift-to-region
- ( deffun shift-to-region
- ( indent-region-sub( 0 )
- para
- prompt-counter cmd-in ( "shift-depth "? " )
- indent-region-sub( -(cmd-in store-pos) )
- )
- )
- ;OCL}}}
- ;OCL{{{ undelcares
- ( undeclare ( irsx irsy irex irey ir-help ) )
- ;OCL}}}
- ) )
- ;OCL}}}
- ;OCL{{{ switch-to-edit-mode-insert
- ( deffun switch-to-edit-mode-insert
- ( set command 1
- switch-to-edit-mode
- delete-mode-overwrite
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-to-edit-mode-overwrite
- ( deffun switch-to-edit-mode-overwrite
- ( set command 1
- switch-to-edit-mode
- add-mode-overwrite
- )
- )
- ;OCL}}}
- ;OCL{{{ move-menu
- ( deffun move-menu
- ( if not(in-prompt)
- ( begin-prompt-macro
- set cmd-in 1
- menu-counter cmd-in ( "Ok " "Bindings " "Help " "Fold " "Indent " "Edit )
- end-prompt-macro
- case
- ( =(cmd-in 0) ( message ( ) ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( describe-bindings ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( mori-help ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( fold-mark-region ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( indent-region-sub( 0 ) ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( set command 1 switch-to-edit-mode ) )
- default
- ( abort-macro )
- esac
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ undeclare's
- ( undeclare
- ( edit-over
- select-no-highlight
- select-highlight
- handle-fold-op-join
- handle-copy-op
- indent-region-sub
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ buffer-move macs and mode string
- ;OCL{{{ vars
- ( defvar ( buff-arg ) )
- ;OCL}}}
- @lib buff-chg
- @lib buff-size
- ;OCL{{{ buffer-size-message
- ( deffun buffer-size-message
- ( message
- (
- "[
- counter screen-height
- "x
- counter screen-width
- "]
- )
- )
- )
- ;OCL}}}
- ;OCL{{{ buffer-op
- ( deffun ( o ) buffer-op
- ( if >(buff-arg 1)
- ;OCL{{{ repeat action without screen
- ( screen-off
- do
- ( insert-ascii o
- set buff-arg -(buff-arg 1)
- )
- while >(buff-arg 0)
- screen-on
- redraw-display
- )
- ;OCL}}}
- else
- ;OCL{{{ do once
- ( insert-ascii o )
- ;OCL}}}
- fi
- buffer-size-message
- )
- )
- ;OCL}}}
- ;OCL{{{ b-m-full-size-buffer
- ( deffun b-m-full-size-buffer ( full-size-buffer buffer-size-message ) )
- ;OCL}}}
- ;OCL{{{ b-m-exit-buffer
- ( deffun b-m-exit-buffer
- ( if >(used-buffers 1)
- ( exit-buffer
- )
- else
- ( switch-off-buffer-handling
- message ( M_NO_BUFFERS )
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ b-m-grow-buffer
- ( deffun b-m-grow-buffer ( buffer-op(grow-buffer) ) )
- ;OCL}}}
- ;OCL{{{ b-m-shrink-buffer
- ( deffun b-m-shrink-buffer ( buffer-op(shrink-buffer) ) )
- ;OCL}}}
- ;OCL{{{ b-m-widen-buffer
- ( deffun b-m-widen-buffer ( buffer-op(widen-buffer) ) )
- ;OCL}}}
- ;OCL{{{ b-m-narrow-buffer
- ( deffun b-m-narrow-buffer ( buffer-op(narrow-buffer) ) )
- ;OCL}}}
- ;OCL{{{ b-m-go-buffer
- ( deffun b-m-go-buffer
- (
- ;OCL{{{ maybe prompt for number
- if <=(buff-arg 0)
- ( para
- prompt-counter buff-arg ( "buffernumber " "? )
- buffer-move
- )
- fi
- ;OCL}}}
- ;OCL{{{ maybe switch buffer
- if and(>(buff-arg 0) <=(buff-arg used-buffers))
- ( goto-buffer-number buff-arg )
- fi
- ;OCL}}}
- message ()
- )
- )
- ;OCL}}}
- ;OCL{{{ init-buff-arg
- ( deffun ( x ) init-buff-arg
- ( if =(buff-arg -1)
- ( set buff-arg x )
- else
- ( set buff-arg +(*(10 buff-arg) x) )
- fi
- message ( M_ARG counter buff-arg )
- )
- )
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-0
- ( deffun b-m-set-argument-0 ( init-buff-arg(0) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-1
- ( deffun b-m-set-argument-1 ( init-buff-arg(1) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-2
- ( deffun b-m-set-argument-2 ( init-buff-arg(2) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-3
- ( deffun b-m-set-argument-3 ( init-buff-arg(3) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-4
- ( deffun b-m-set-argument-4 ( init-buff-arg(4) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-5
- ( deffun b-m-set-argument-5 ( init-buff-arg(5) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-6
- ( deffun b-m-set-argument-6 ( init-buff-arg(6) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-7
- ( deffun b-m-set-argument-7 ( init-buff-arg(7) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-8
- ( deffun b-m-set-argument-8 ( init-buff-arg(8) ))
- ;OCL}}}
- ;OCL{{{ b-m-set-argument-9
- ( deffun b-m-set-argument-9 ( init-buff-arg(9) ))
- ;OCL}}}
- ;OCL{{{ b-m-menu
- ( deffun b-m-menu
- ( set cmd-in 1
- para
- ;OCL{{{ ask for commad type
- menu-counter
- cmd-in
- ( "Ok "- counter current-buffer-number
- " "Size
- " "Change
- " "New
- " "Quit
- )
- ;OCL}}}
- buffer-move
- case
- ;OCL{{{ ok
- ( =(cmd-in 0) ( switch-off-buffer-handling ) )
- ;OCL}}}
- ;OCL{{{ size
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( reset-user-mode BM
- set-user-mode BZ
- local
- ()
- ;OCL{{{ size-loop
- ( while 1
- (
- ;OCL{{{ get command-code
- set cmd-in 0
- para
- menu-counter
- cmd-in
- ( "Ok "- counter current-buffer-number
- "[
- counter screen-height
- "cmd-in
- counter screen-width
- "]
- " "Grow
- " "Shrink
- " "Widen
- " "Narrow
- )
- buffer-move
- ;OCL}}}
- case
- ( =(cmd-in 0) ( return-from-macro ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( grow-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( shrink-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( widen-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( narrow-buffer ) )
- esac
- )
- )
- ;OCL}}}
- reset-user-mode BZ
- set-user-mode BM
- b-m-menu
- )
- )
- ;OCL}}}
- ;OCL{{{ change
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( reset-user-mode BM
- set-user-mode BC
- if >(used-buffers 1)
- ;OCL{{{ menu
- ( local
- ()
- ;OCL{{{ change-loop
- ( while 1
- (
- ;OCL{{{ get command-code
- set cmd-in 0
- para
- ;OCL{{{ ask for command
- menu-counter
- cmd-in
- ( "Ok "- counter current-buffer-number
- " "Up
- " "Down
- " "Left
- " "Right
- " "Previous
- " "Nexnt
- " "Select
- )
- ;OCL}}}
- buffer-move
- ;OCL}}}
- case
- ( =(cmd-in 0) ( return-from-macro ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( up-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( down-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( left-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( right-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( previous-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( next-buffer ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0) ( e-m-list-buffers return-from-macro ) )
- esac
- )
- )
- ;OCL}}}
- )
- ;OCL}}}
- else
- ;OCL{{{ message
- ( bell
- visible-bell
- )
- ;OCL}}}
- fi
- reset-user-mode BC
- set-user-mode BM
- b-m-menu
- )
- )
- ;OCL}}}
- ;OCL{{{ new
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( reset-user-mode BM
- set-user-mode BN
- ;OCL{{{ get command-code
- set cmd-in 0
- para
- menu-counter
- cmd-in
- ( "Ok "- counter current-buffer-number
- " "Buffer
- " "Adjacent-buffer
- )
- buffer-move
- ;OCL}}}
- reset-user-mode BN
- set-user-mode BM
- case
- ( =(cmd-in 0) ( ) )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( switch-off-buffer-handling open-buffer return-from-macro )
- )
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- ( switch-off-buffer-handling open-adjacent-buffer return-from-macro )
- )
- esac
- b-m-menu
- )
- )
- ;OCL}}}
- ;OCL{{{ quit
- ( pre ( set cmd-in -(cmd-in 1) ) =(cmd-in 0)
- (
- ;OCL{{{ store file modified in string-buffer
- screen-off
- history-edit string-buffer ()
- insert-ascii M_CHANGED_LEAVE
- newline-and-indent
- screen-on
- ;OCL}}}
- b-m-exit-buffer
- if in-prompt ( yes-no-menu(true) ) fi
- if buffer-moving
- ( b-m-menu )
- fi
- )
- )
- ;OCL}}}
- default
- ( abort-macro )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ undeclares
- ( undeclare ( init-buff-arg ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ switches
- ;OCL{{{ switch-on-buffer-handling
- ( deffun switch-on-buffer-handling
- ( set buffer-moving 1
- set buff-arg -1
- reset-user-mode ED
- set-user-mode BM
- buffer-move
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-off-buffer-handling
- ( deffun switch-off-buffer-handling
- ( set-user-mode ED
- reset-user-mode BM
- edit
- set buffer-moving 0
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-to-move-mode
- ( deffun switch-to-move-mode
- ( if in-prompt ( return-from-macro ) fi
- reset-user-mode ED
- set-user-mode MV
- delay-auto-save
- set-start-mark
- set-end-mark
- moves
- set moving 1
- store-move-modes
- status-line-on
- set command 0
- set irline 0
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-to-edit-mode
- ( deffun switch-to-edit-mode
- ( if in-prompt ( return-from-macro ) fi
- clear-marks
- reset-user-mode MV
- reset-user-mode BM
- reset-user-mode SH
- set-user-mode ED
- edit
- ;OCL{{{ reset move-mode
- if moving
- ( set moving 0
- flush-auto-save
- )
- fi
- ;OCL}}}
- restore-move-modes
- ;OCL{{{ maybe bell (exit without correct ended command)
- if and(=(command 0) <>(startup 0)) ( bell visible-bell ) fi
- ;OCL}}}
- ;OCL{{{ maybe switch statusline off
- if =(status-line 0) ( status-line-off ) fi
- ;OCL}}}
- ;OCL{{{ maybe redraw
- if <>(command 0) ( redraw-display ) fi
- ;OCL}}}
- set irline 0
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ modes
- @lib autolang
- ;OCL{{{ statusline
- ( defvar ( really-no-stat ) )
- ;OCL{{{ check-status-line
- ( defmac check-status-line
- ( if and(not(really-no-stat) >(used-buffers 1))
- ( switch-status-line-on )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-status-line-off
- ( deffun switch-status-line-off
- ( case
- ( in-prompt ( ) )
- default
- ( set status-line false
- status-line-off
- if >(used-buffers 1) ( set really-no-stat 1 ) fi
- )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ switch-status-line-on
- ( deffun switch-status-line-on
- ( case
- ( in-prompt ( ) )
- default
- ( set status-line true
- status-line-on
- )
- esac
- )
- )
- ;OCL}}}
- ( undeclare ( really-no-stat ) )
- ;OCL}}}
- ;OCL{{{ add-mode-extended
- @if-using (L-EXT)
- ( deffun add-mode-extended
- ( set extended-version 1
- reset-user-mode NOEX
- @if-using (L-EXT)
- set-user-mode LEXT
- @fi
- )
- )
- @fi
- @if-using not(L-EXT)
- ( defmac add-mode-extended ( delete-mode-extended ) )
- @fi
- ;OCL}}}
- ;OCL{{{ delete-mode-extended
- ( deffun delete-mode-extended
- ( set extended-version -1
- reset-user-mode NOEX
- @if-using (L-EXT)
- reset-user-mode LEXT
- @fi
- )
- )
- ;OCL}}}
- ;OCL{{{ set-mode-raw
- ( deffun set-mode-raw
- ( switch-to-edit-mode
- set extended-version 0
- set-user-mode NOEX
- @if-using (L-EXT)
- reset-user-mode LEXT
- @fi
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-add-mode-full-shift
- ( deffun mori-add-mode-full-shift
- ( set full-shifting 1
- add-mode-full-shift
- )
- )
- ;OCL}}}
- ;OCL{{{ mori-delete-mode-full-shift
- ( deffun mori-delete-mode-full-shift
- ( set full-shifting 0
- delete-mode-full-shift
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ hooks
- ;OCL{{{ buff-init-state
- ( deffun buff-init-state
- ( @if-using (L-EXT)
- ;OCL{{{ maybe switch on wrap
- touch-char-sets
- if or(test-language Roff test-language TeX)
- ( add-mode-wrap )
- else
- ( delete-mode-wrap )
- fi
- ;OCL}}}
- @fi
- )
- )
- ;OCL}}}
- ;OCL{{{ change-buffer-macro-exe
- ( deffun change-buffer-macro-exe
- ( @if-using ( ALIEN-HOOKS )
- if eval ( alien-change-buffer-macro ) ( return-from-macro ) fi
- @fi
- @if-using ( SHELL-MODE )
- if shell-mode-active
- ( return-from-macro )
- fi
- @fi
- check-status-line
- set buff-arg -1
- buff-init-state
- )
- )
- ;OCL}}}
- ;OCL{{{ read-newfile-macro-exe
- ;OCL{{{ variables
- ( defvar ( size-h size-w start-ocl x rec-rnf-mac ) )
- ;OCL}}}
- ;OCL{{{ startup macros
- ( demand-load
- (
- ;OCL{{{ startup1
- ( deffun startup-1
- ( screen-off
- ;OCL{{{ init fill column with 79
- set modify-behaviour 79
- set-fill-column
- set modify-behaviour 0
- ;OCL}}}
- ;OCL{{{ prepare internal mode handling
- ;OCL{{{ statusline
- set status-line true
- ;OCL}}}
- ;OCL{{{ extended mode
- set extended-version 1
- ;OCL}}}
- set-user-mode ED
- add-mode-auto-indent
- add-mode-auto-language
- ;OCL}}}
- ;OCL{{{ get environment variables
- ;OCL{{{ EDT used?
- @if-using ( SUNEDT )
- if test-term "SUNEDT
- ( set EDT-used 1 )
- else
- ;OCL{{{ check ORIGAMITERM
- ( history-edit misc ()
- getenv "ORIGAMITERM
- if
- ;OCL{{{ ==SUNEDT
- and
- ( pre
- ( backward-character
- backward-character
- backward-character
- backward-character
- backward-character
- backward-character
- )
- test-str "SUNEDT
- test-begin-line
- )
- ;OCL}}}
- ( set EDT-used 1 )
- fi
- newline-and-indent
- )
- ;OCL}}}
- fi
- if EDT-used
- ( set-user-mode EDT-TAG )
- fi
- @fi
- ;OCL}}}
- ;OCL{{{ get MAKE_CMD
- history-edit make-cmd-hist ()
- get-make-cmd-var
- if test-begin-line
- ( make-cmd-def )
- fi
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ get SPELL_CMD
- history-edit spell-command ()
- get-spell-cmd-var
- if test-begin-line
- ( default-spell-command )
- fi
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ get MAIL_CMD
- history-edit mail-cmd-hist ()
- get-mail-cmd-var
- if test-begin-line
- ( mail-cmd-def )
- fi
- newline-and-indent
- ;OCL}}}
- @if-using ( SHELL-MODE )
- I-startup-read
- @fi
- ;OCL}}}
- ;OCL{{{ handle ocl-argument
- ;OCL{{{ tags-file
- history-edit tags-file ()
- if ocl-arg-field(2)
- ( set tags-user-tags-file true
- get-history argument-list -(ocl-arg-field(1) ocl-arg-field(2))
- )
- else
- ( "default )
- fi
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ spell-command
- history-edit spell-command ()
- get-history argument-list -(ocl-arg-field(1) ocl-arg-field(4))
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ make
- history-edit make-cmd-hist ()
- get-history argument-list -(ocl-arg-field(1) ocl-arg-field(5))
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ mail
- history-edit mail-cmd-hist ()
- get-history argument-list -(ocl-arg-field(1) ocl-arg-field(6))
- newline-and-indent
- ;OCL}}}
- @if-using ( SHELL-MODE )
- ;OCL{{{ nn
- history-edit I-nn-cmd ()
- get-history argument-list -(ocl-arg-field(1) ocl-arg-field(7))
- newline-and-indent
- ;OCL}}}
- @fi
- ;OCL{{{ match filter
- history-edit match ()
- previous-line
- if test-begin-line ( ". ) fi
- newline-and-indent
- ;OCL}}}
- ;OCL{{{ no-match filter
- history-edit no-match ()
- previous-line
- if test-begin-line ( insert-ascii path-separator ) fi
- newline-and-indent
- ;OCL}}}
- set start-ocl ocl-argument
- do
- (
- ;OCL{{{ init ocl-argument value
- set cmd-in 0
- if <>(ocl-argument -1)
- ( set cmd-in ocl-argument )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 8192, 1=lond-diredit off
- if >=(cmd-in 8192)
- ( set cmd-in -(cmd-in 8192) )
- else
- ( set diredit-long 1 )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 4096, 1=center on
- if >=(cmd-in 4096)
- ( set cmd-in -(cmd-in 4096)
- add-mode-center
- )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 2048, 1=time off
- if >=(cmd-in 2048)
- ( set cmd-in -(cmd-in 2048) )
- else
- ( add-mode-time )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 1024, 1=no-overstrike
- if >=(cmd-in 1024)
- ( no-overstrike
- set cmd-in -(cmd-in 1024)
- )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 512, 0=auto-langage on
- if >=(cmd-in 512)
- ( delete-mode-auto-language
- set cmd-in -(cmd-in 512)
- )
- else
- ( add-mode-auto-language )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 256, 0=full-shift on
- if >=(cmd-in 256)
- ( mori-delete-mode-full-shift
- set cmd-in -(cmd-in 256)
- )
- else
- ( mori-add-mode-full-shift )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 128, 0=autoindent on
- if >=(cmd-in 128)
- ( delete-mode-auto-indent
- set cmd-in -(cmd-in 128)
- )
- else
- ( add-mode-auto-indent )
- fi
- ;OCL}}}
- ;OCL{{{ handle bits 64/32, 0=xmagic
- case
- ( >=(cmd-in 96) ( delete-mode-regular-expression set cmd-in -(cmd-in 96) ) )
- ( >=(cmd-in 64) ( add-mode-basic-regular-expression set cmd-in -(cmd-in 64) ) )
- ( >=(cmd-in 32) ( add-mode-basic-regular-expression set cmd-in -(cmd-in 32) ) )
- default
- ( add-mode-extended-regular-expression )
- esac
- ;OCL}}}
- ;OCL{{{ handle bit 16, 0=highlight on
- if >=(cmd-in 16)
- ( delete-mode-highlight
- set cmd-in -(cmd-in 16)
- )
- else
- ( add-mode-highlight )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 8, 0=position on
- if >=(cmd-in 8)
- ( delete-mode-position
- set cmd-in -(cmd-in 8)
- )
- else
- ( add-mode-position )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 4, 0=buff-save off
- if >=(cmd-in 4)
- ( set cmd-in -(cmd-in 4)
- add-mode-buffer-save
- )
- else
- ( delete-mode-buffer-save )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 2, 0=extended
- if >=(cmd-in 2)
- ( set cmd-in -(cmd-in 2)
- delete-mode-extended
- )
- else
- ( add-mode-extended )
- fi
- ;OCL}}}
- ;OCL{{{ handle bit 1, 0=statusline on
- if >(cmd-in 0)
- ( set cmd-in -(cmd-in 1)
- switch-status-line-off
- )
- else
- ( switch-status-line-on )
- fi
- ;OCL}}}
- ;OCL{{{ check, if valid value given
- if <>(cmd-in 0)
- ( set ocl-argument -1
- set startup -1
- )
- else
- ( set ocl-argument 0 )
- fi
- ;OCL}}}
- )
- while <>(ocl-argument 0)
- ;OCL}}}
- ;OCL{{{ maybe redraw, window size changed?
- set size-h screen-height
- set size-w screen-width
- set modify-behaviour 1
- center-and-redraw-display
- set modify-behaviour 0
- if or(<>(size-h screen-height) <>(size-w screen-width))
- ( center-and-redraw-display )
- fi
- screen-on
- ;OCL}}}
- screen-on
- )
- )
- ;OCL}}}
- ;OCL{{{ startup2
- ( deffun startup-2
- ( load-function not( startup-1 )
- ;OCL{{{ go tag/start shell or show startup message
- if =(startup 0)
- ( set startup 1
- @if-using ( SHELL-MODE )
- if ocl-arg-field(15)
- ;OCL{{{ start as shell
- ( begin-shell-mode
- I-startup
- exit
- )
- ;OCL}}}
- fi
- @fi
- ;OCL{{{ gotags
- if >(ocl-arg-field(3) 0)
- ( screen-off
- history-edit search ()
- get-history argument-list -(ocl-arg-field(3) 1)
- newline-and-indent
- screen-on
- set ocl-arg-field(3) -1
- go-tag-mark(false true true)
- set ocl-arg-field(3) 0
- )
- fi
- ;OCL}}}
- case
- ( tags-error ( tags-complain exit ) )
- default
- ( if and(diredit-long =(file-type 1))
- ( message ( "[ "long " "directory " "data! "] )
- screen-off
- set rec-rnf-mac true
- set modify-behaviour +(file-number 1)
- read-list-file
- set modify-behaviour 0
- screen-on
- redraw-display
- )
- fi
- message-exit ( "[ "Have " "a " "nice " "day! "] )
- )
- esac
- )
- else
- ( set startup 1
- message-exit ( "[ "invalid " "ocl-init " counter start-ocl ", " "using " "default=0! "] )
- )
- fi
- ;OCL}}}
- )
- )
- ;OCL}}}
- )
- )
- ;OCL}}}
-
- ( deffun read-newfile-macro-exe
- ( if not(rec-rnf-mac)
- ( @if-using ( ALIEN-HOOKS )
- if eval ( alien-read-newfile-macro ) ( return-from-macro ) fi
- @fi
- ;OCL{{{ startup-stuff
- if =(startup 0) ( startup-1 ) fi
- ;OCL}}}
- @if-using ( SHELL-MODE )
- if shell-mode-active
- ( return-from-macro )
- fi
- @fi
- buff-init-state
- @if-using ( ADD-NEWFILE )
- add-new-file
- @fi
- ;OCL{{{ maybe edit mode, no command check
- if and(=(buffer-moving 0) not(moving))
- ( set command 1
- switch-to-edit-mode
- )
- fi
- ;OCL}}}
- ;OCL{{{ maybe change file at startup
- if not(no-auto-change)
- ( set-auto-language
- ;OCL{{{ maybe empty-file to one-line-file
- if and(=(file-type 0) test-bottom =(1 store-line))
- ( screen-off
- beginning-of-line
- newline-and-indent
- set-file-unchanged
- previous-line
- screen-on
- redraw-display
- )
- fi
- ;OCL}}}
- )
- fi
- ;OCL}}}
- ;OCL{{{ startup stuff
- if <=(startup 0) ( startup-2 ) fi
- ;OCL}}}
- message ( history error-list )
- )
- fi
- set rec-rnf-mac false
- )
- )
- ;OCL{{{ undeclare startup macros and variables
- ( undeclare ( size-h size-w startup-1 startup-2 startup start-ocl x rec-rnf-mac ) )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ knb-macro
- ( deffun knb-macro
- ( @if-using ( ALIEN-HOOKS )
- if eval ( alien-key-not-bound-macro ) ( return-from-macro ) fi
- @fi
- @if-using ( SHELL-MODE )
- if shell-mode-active
- ( I-key-not-bound
- return-from-macro
- )
- fi
- @fi
- set buff-arg -1
- if not(in-prompt)
- ( message ( M_NOT_BOUND )
- if =(0 buffer-moving) ( abort-hook ) fi
- )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ v-macro
- ( deffun v-macro
- ( @if-using ( ALIEN-HOOKS )
- if eval ( alien-view-macro ) ( return-from-macro ) fi
- @fi
- @if-using ( SHELL-MODE )
- if shell-mode-active
- ( I-view-macro
- return-from-macro
- )
- fi
- @fi
- if and(=(moving 0) =(buffer-moving 0))
- ( message ( M_VIEW ) abort-macro )
- else
- ( knb-macro )
- fi
- )
- )
- ;OCL}}}
- ;OCL{{{ abort-hook
- ( forward lib-abort-hooks )
- ( deffun abort-hook
- ( @if-using ( ALIEN-HOOKS )
- if eval ( alien-abort-macro ) ( return-from-macro ) fi
- @fi
- @if-using ( SHELL-MODE )
- if shell-mode-active
- ( I-abort-hook
- return-from-macro
- )
- fi
- @fi
- ;OCL{{{ cmd-in=1, if abort
- case
- ( last-message M_ABORTED ( set cmd-in 1 ))
- ( and(last-message M_VIEW =(moving 0))
- ( set cmd-in -1)
- )
- default
- ( set cmd-in 0 )
- esac
- ;OCL}}}
- lib-abort-hooks
- set no-auto-change false
- set modify-behaviour 0
- set prompting false
- reset-user-mode FM
- reset-user-mode TM
- reset-user-mode PM
- reset-user-mode BC
- reset-user-mode BM
- reset-user-mode BN
- reset-user-mode BZ
- ;OCL{{{ full-shift
- if full-shifting ( add-mode-full-shift ) else ( delete-mode-full-shift ) fi
- ;OCL}}}
- case
- ( <>(buffer-moving 0) ( switch-off-buffer-handling redraw-display ) )
- ( =(moving 0) ( redraw-display edit ) )
- default
- ( switch-to-edit-mode )
- esac
- restore-auto-save
- case
- ( >(cmd-in 0) ( message-exit ( M_ABORTED )))
- ( =(cmd-in 0) ( message-exit ( M_NOT_BOUND )))
- default
- ( message-exit ( M_VIEW ))
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ begin-prompt
- ( deffun begin-prompt
- ( case
- @if-using ( ALIEN-HOOKS )
- ( eval ( alien-begin-prompt-macro ) ( ) )
- @fi
- @if-using ( SHELL-MODE )
- ( shell-mode-active ( I-prompt-in ) )
- @fi
- ( moving ( para ) )
- ( buffer-moving ( para ) )
- default
- ( if prompting ( para ) fi )
- esac
- )
- )
- ;OCL}}}
- ;OCL{{{ end-prompt
- ( deffun end-prompt
- ( case
- @if-using ( ALIEN-HOOKS )
- ( eval ( alien-end-prompt-macro ) ( ) )
- @fi
- @if-using ( SHELL-MODE )
- ( shell-mode-active ( I-prompt-out ) )
- @fi
- ( moving ( moves ) )
- ( buffer-moving ( buffer-move ) )
- default
- ( edit )
- esac
- )
- )
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ redefine save/exits for buffer-save
- ;OCL{{{ e-m-save-file
- ( defmac e-m-save-file- ( e-m-save-file ) )
- ( undeclare ( e-m-save-file ) )
- ( deffun e-m-save-file
- ( if and(not(in-prompt) buff-saving) ( mori-dump-buffers-to-file ) fi
- e-m-save-file-
- )
- )
- ( undeclare ( e-m-save-file- ) )
- ;OCL}}}
- ;OCL{{{ exit-buffer
- ( defmac exit-buffer- ( exit-buffer ) )
- ( undeclare ( exit-buffer ) )
- ( @if-using ( SHELL-MODE ) defmac @fi
- @if-using not( SHELL-MODE ) deffun @fi
- exit-buffer
- ( if and(not(in-prompt) buff-saving) ( mori-dump-buffers-to-file ) fi
- exit-buffer-
- )
- )
- ( undeclare ( exit-buffer- ) )
- ;OCL}}}
- ;OCL{{{ exit-origami
- ( defmac exit-origami- ( exit-origami ) )
- ( undeclare ( exit-origami ) )
- ( @if-using ( SHELL-MODE ) defmac @fi
- @if-using not( SHELL-MODE ) deffun @fi
- exit-origami
- ( if and(not(in-prompt) buff-saving) ( mori-dump-buffers-to-file ) fi
- exit-origami-
- )
- )
- ( undeclare ( exit-origami- ) )
- ;OCL}}}
- ;OCL{{{ save-and-exit-buffer
- ( defmac save-and-exit-buffer- ( save-and-exit-buffer ) )
- ( undeclare ( save-and-exit-buffer ) )
- ( @if-using ( SHELL-MODE ) defmac @fi
- @if-using not( SHELL-MODE ) deffun @fi
- save-and-exit-buffer
- ( if and(not(in-prompt) buff-saving) ( mori-dump-buffers-to-file ) fi
- save-and-exit-buffer-
- )
- )
- ( undeclare ( save-and-exit-buffer- ) )
- ;OCL}}}
- ;OCL}}}
-